diff -Nru bamf-0.2.112/configure bamf-0.2.114/configure --- bamf-0.2.112/configure 2012-03-23 13:48:57.000000000 +0000 +++ bamf-0.2.114/configure 2012-03-23 13:48:57.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for bamf 0.2.112. +# Generated by GNU Autoconf 2.68 for bamf 0.2.114. # # Report bugs to . # @@ -570,8 +570,8 @@ # Identity of this package. PACKAGE_NAME='bamf' PACKAGE_TARNAME='bamf' -PACKAGE_VERSION='0.2.112' -PACKAGE_STRING='bamf 0.2.112' +PACKAGE_VERSION='0.2.114' +PACKAGE_STRING='bamf 0.2.114' PACKAGE_BUGREPORT='dx-team@canonical.com' PACKAGE_URL='' @@ -1377,7 +1377,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures bamf 0.2.112 to adapt to many kinds of systems. +\`configure' configures bamf 0.2.114 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1447,7 +1447,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of bamf 0.2.112:";; + short | recursive ) echo "Configuration of bamf 0.2.114:";; esac cat <<\_ACEOF @@ -1587,7 +1587,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -bamf configure 0.2.112 +bamf configure 0.2.114 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1865,7 +1865,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by bamf $as_me 0.2.112, which was +It was created by bamf $as_me 0.2.114, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2686,7 +2686,7 @@ # Define the identity of the package. PACKAGE='bamf' - VERSION='0.2.112' + VERSION='0.2.114' cat >>confdefs.h <<_ACEOF @@ -15228,7 +15228,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by bamf $as_me 0.2.112, which was +This file was extended by bamf $as_me 0.2.114, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15294,7 +15294,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -bamf config.status 0.2.112 +bamf config.status 0.2.114 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff -Nru bamf-0.2.112/configure.in bamf-0.2.114/configure.in --- bamf-0.2.112/configure.in 2012-03-23 13:48:57.000000000 +0000 +++ bamf-0.2.114/configure.in 2012-03-23 13:48:57.000000000 +0000 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.63]) -AC_INIT(bamf, 0.2.112, dx-team@canonical.com) +AC_INIT(bamf, 0.2.114, dx-team@canonical.com) AC_PREREQ(2.62) AC_CONFIG_SRCDIR(src/main.c) diff -Nru bamf-0.2.112/debian/changelog bamf-0.2.114/debian/changelog --- bamf-0.2.112/debian/changelog 2012-03-23 13:48:57.000000000 +0000 +++ bamf-0.2.114/debian/changelog 2012-03-23 13:48:57.000000000 +0000 @@ -1,3 +1,10 @@ +bamf (0.2.114-0ubuntu1) precise-proposed; urgency=low + + * New upstream release. + - invalid valgrind read errors (LP: #929468) + + -- Didier Roche Fri, 23 Mar 2012 14:16:41 +0100 + bamf (0.2.112-0ubuntu1) precise; urgency=low * New upstream release. diff -Nru bamf-0.2.112/doc/reference/libbamf/html/api-index-full.html bamf-0.2.114/doc/reference/libbamf/html/api-index-full.html --- bamf-0.2.112/doc/reference/libbamf/html/api-index-full.html 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/html/api-index-full.html 2012-03-23 12:17:25.000000000 +0000 @@ -486,6 +486,10 @@
+bamf_window_get_pid, function in BamfWindow +
+
+
bamf_window_get_transient, function in BamfWindow
diff -Nru bamf-0.2.112/doc/reference/libbamf/html/BamfWindow.html bamf-0.2.114/doc/reference/libbamf/html/BamfWindow.html --- bamf-0.2.112/doc/reference/libbamf/html/BamfWindow.html 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/html/BamfWindow.html 2012-03-23 12:17:25.000000000 +0000 @@ -46,6 +46,7 @@ enum BamfWindowMaximizationType; enum BamfWindowType; gint bamf_window_get_monitor (BamfWindow *self); +guint32 bamf_window_get_pid (BamfWindow *self); BamfWindow * bamf_window_get_transient (BamfWindow *self); gchar * bamf_window_get_utf8_prop (BamfWindow *self, const char *prop); @@ -138,6 +139,13 @@
+

bamf_window_get_pid ()

+
guint32             bamf_window_get_pid                 (BamfWindow *self);
+

+

+
+
+

bamf_window_get_transient ()

BamfWindow *        bamf_window_get_transient           (BamfWindow *self);

diff -Nru bamf-0.2.112/doc/reference/libbamf/html/ch01.html bamf-0.2.114/doc/reference/libbamf/html/ch01.html --- bamf-0.2.112/doc/reference/libbamf/html/ch01.html 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/html/ch01.html 2012-03-23 12:17:25.000000000 +0000 @@ -21,7 +21,7 @@

-Classes

+Classes
BamfMatcher — The base class for all matchers diff -Nru bamf-0.2.112/doc/reference/libbamf/html/index.sgml bamf-0.2.114/doc/reference/libbamf/html/index.sgml --- bamf-0.2.112/doc/reference/libbamf/html/index.sgml 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/html/index.sgml 2012-03-23 12:17:25.000000000 +0000 @@ -37,6 +37,7 @@ + diff -Nru bamf-0.2.112/doc/reference/libbamf/html/libbamf.devhelp2 bamf-0.2.114/doc/reference/libbamf/html/libbamf.devhelp2 --- bamf-0.2.112/doc/reference/libbamf/html/libbamf.devhelp2 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/html/libbamf.devhelp2 2012-03-23 12:17:25.000000000 +0000 @@ -42,6 +42,7 @@ + diff -Nru bamf-0.2.112/doc/reference/libbamf/libbamf-sections.txt bamf-0.2.114/doc/reference/libbamf/libbamf-sections.txt --- bamf-0.2.112/doc/reference/libbamf/libbamf-sections.txt 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/libbamf-sections.txt 2012-03-23 12:17:25.000000000 +0000 @@ -200,6 +200,7 @@ BamfWindowMaximizationType BamfWindowType bamf_window_get_monitor +bamf_window_get_pid bamf_window_get_transient bamf_window_get_utf8_prop bamf_window_get_window_type diff -Nru bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-application.sgml bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-application.sgml --- bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-application.sgml 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-application.sgml 2012-03-23 12:17:25.000000000 +0000 @@ -9,11 +9,13 @@ + + diff -Nru bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-control.sgml bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-control.sgml --- bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-control.sgml 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-control.sgml 2012-03-23 12:17:25.000000000 +0000 @@ -9,11 +9,13 @@ + + diff -Nru bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-factory.sgml bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-factory.sgml --- bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-factory.sgml 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-factory.sgml 2012-03-23 12:17:25.000000000 +0000 @@ -9,11 +9,13 @@ + + diff -Nru bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-indicator.sgml bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-indicator.sgml --- bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-indicator.sgml 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-indicator.sgml 2012-03-23 12:17:25.000000000 +0000 @@ -9,11 +9,13 @@ + + diff -Nru bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-matcher.sgml bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-matcher.sgml --- bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-matcher.sgml 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-matcher.sgml 2012-03-23 12:17:25.000000000 +0000 @@ -9,11 +9,13 @@ + + diff -Nru bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-tab.sgml bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-tab.sgml --- bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-tab.sgml 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-tab.sgml 2012-03-23 12:17:25.000000000 +0000 @@ -9,11 +9,13 @@ + + diff -Nru bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-tab-source.sgml bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-tab-source.sgml --- bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-tab-source.sgml 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-tab-source.sgml 2012-03-23 12:17:25.000000000 +0000 @@ -9,11 +9,13 @@ + + diff -Nru bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-view-private.sgml bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-view-private.sgml --- bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-view-private.sgml 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-view-private.sgml 2012-03-23 12:17:25.000000000 +0000 @@ -9,11 +9,13 @@ + + diff -Nru bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-view.sgml bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-view.sgml --- bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-view.sgml 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-view.sgml 2012-03-23 12:17:25.000000000 +0000 @@ -9,11 +9,13 @@ + + diff -Nru bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-window.sgml bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-window.sgml --- bamf-0.2.112/doc/reference/libbamf/tmpl/bamf-window.sgml 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/tmpl/bamf-window.sgml 2012-03-23 12:17:25.000000000 +0000 @@ -9,11 +9,13 @@ + + @@ -86,6 +88,15 @@ @Returns: + + + + + +@self: +@Returns: + + diff -Nru bamf-0.2.112/doc/reference/libbamf/tmpl/libbamf.sgml bamf-0.2.114/doc/reference/libbamf/tmpl/libbamf.sgml --- bamf-0.2.112/doc/reference/libbamf/tmpl/libbamf.sgml 2012-03-12 08:49:45.000000000 +0000 +++ bamf-0.2.114/doc/reference/libbamf/tmpl/libbamf.sgml 2012-03-23 12:17:25.000000000 +0000 @@ -9,11 +9,13 @@ + + diff -Nru bamf-0.2.112/src/bamf-application.c bamf-0.2.114/src/bamf-application.c --- bamf-0.2.112/src/bamf-application.c 2012-02-17 10:58:15.000000000 +0000 +++ bamf-0.2.114/src/bamf-application.c 2012-03-23 12:14:13.000000000 +0000 @@ -49,12 +49,12 @@ #define STUB_KEY "X-Ayatana-Appmenu-Show-Stubs" -static char * +static const char * bamf_application_get_icon (BamfView *view) { g_return_val_if_fail (BAMF_IS_APPLICATION (view), NULL); - return g_strdup (BAMF_APPLICATION (view)->priv->icon); + return BAMF_APPLICATION (view)->priv->icon; } char * diff -Nru bamf-0.2.112/src/bamf-gdbus-browser-generated.c bamf-0.2.114/src/bamf-gdbus-browser-generated.c --- bamf-0.2.112/src/bamf-gdbus-browser-generated.c 2012-02-17 11:00:05.000000000 +0000 +++ bamf-0.2.114/src/bamf-gdbus-browser-generated.c 2012-01-12 11:15:49.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Generated by gdbus-codegen 2.31.16. DO NOT EDIT. + * Generated by gdbus-codegen 2.31.8. DO NOT EDIT. * * The license of this code is the same as for the source it was derived from. */ @@ -1739,7 +1739,7 @@ struct _BamfDBusBrowserSkeletonPrivate { - GValue *properties; + GValueArray *properties; GList *changed_properties; GSource *changed_properties_idle_source; GMainContext *context; diff -Nru bamf-0.2.112/src/bamf-gdbus-browser-generated.h bamf-0.2.114/src/bamf-gdbus-browser-generated.h --- bamf-0.2.112/src/bamf-gdbus-browser-generated.h 2012-02-17 11:00:05.000000000 +0000 +++ bamf-0.2.114/src/bamf-gdbus-browser-generated.h 2012-01-12 11:15:49.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Generated by gdbus-codegen 2.31.16. DO NOT EDIT. + * Generated by gdbus-codegen 2.31.8. DO NOT EDIT. * * The license of this code is the same as for the source it was derived from. */ diff -Nru bamf-0.2.112/src/bamf-gdbus-generated.c bamf-0.2.114/src/bamf-gdbus-generated.c --- bamf-0.2.112/src/bamf-gdbus-generated.c 2012-02-17 11:00:05.000000000 +0000 +++ bamf-0.2.114/src/bamf-gdbus-generated.c 2012-01-13 08:34:57.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Generated by gdbus-codegen 2.31.16. DO NOT EDIT. + * Generated by gdbus-codegen 2.31.8. DO NOT EDIT. * * The license of this code is the same as for the source it was derived from. */ @@ -1426,7 +1426,7 @@ struct _BamfDBusControlSkeletonPrivate { - GValue *properties; + GValueArray *properties; GList *changed_properties; GSource *changed_properties_idle_source; GMainContext *context; @@ -4926,7 +4926,7 @@ struct _BamfDBusMatcherSkeletonPrivate { - GValue *properties; + GValueArray *properties; GList *changed_properties; GSource *changed_properties_idle_source; GMainContext *context; diff -Nru bamf-0.2.112/src/bamf-gdbus-generated.h bamf-0.2.114/src/bamf-gdbus-generated.h --- bamf-0.2.112/src/bamf-gdbus-generated.h 2012-02-17 11:00:05.000000000 +0000 +++ bamf-0.2.114/src/bamf-gdbus-generated.h 2012-01-13 08:34:57.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Generated by gdbus-codegen 2.31.16. DO NOT EDIT. + * Generated by gdbus-codegen 2.31.8. DO NOT EDIT. * * The license of this code is the same as for the source it was derived from. */ diff -Nru bamf-0.2.112/src/bamf-gdbus-indicator-source-generated.c bamf-0.2.114/src/bamf-gdbus-indicator-source-generated.c --- bamf-0.2.112/src/bamf-gdbus-indicator-source-generated.c 2012-02-17 11:00:05.000000000 +0000 +++ bamf-0.2.114/src/bamf-gdbus-indicator-source-generated.c 2012-01-12 11:15:49.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Generated by gdbus-codegen 2.31.16. DO NOT EDIT. + * Generated by gdbus-codegen 2.31.8. DO NOT EDIT. * * The license of this code is the same as for the source it was derived from. */ @@ -949,7 +949,7 @@ struct _StatusNotifierApproverSkeletonPrivate { - GValue *properties; + GValueArray *properties; GList *changed_properties; GSource *changed_properties_idle_source; GMainContext *context; diff -Nru bamf-0.2.112/src/bamf-gdbus-indicator-source-generated.h bamf-0.2.114/src/bamf-gdbus-indicator-source-generated.h --- bamf-0.2.112/src/bamf-gdbus-indicator-source-generated.h 2012-02-17 11:00:05.000000000 +0000 +++ bamf-0.2.114/src/bamf-gdbus-indicator-source-generated.h 2012-01-12 11:15:49.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Generated by gdbus-codegen 2.31.16. DO NOT EDIT. + * Generated by gdbus-codegen 2.31.8. DO NOT EDIT. * * The license of this code is the same as for the source it was derived from. */ diff -Nru bamf-0.2.112/src/bamf-matcher.c bamf-0.2.114/src/bamf-matcher.c --- bamf-0.2.112/src/bamf-matcher.c 2012-02-17 10:58:15.000000000 +0000 +++ bamf-0.2.114/src/bamf-matcher.c 2012-03-23 12:14:13.000000000 +0000 @@ -46,6 +46,7 @@ VIEW_REMOVED } ViewChangeType; +static BamfMatcher *static_matcher; static guint matcher_signals[LAST_SIGNAL] = { 0 }; struct _BamfMatcherPrivate @@ -117,14 +118,13 @@ else priv->active_win = NULL; - g_signal_emit_by_name (matcher, "active-window-changed", BAMF_IS_VIEW (last) ? bamf_view_get_path (BAMF_VIEW (last)) : "", BAMF_IS_VIEW (priv->active_win) ? bamf_view_get_path (BAMF_VIEW (priv->active_win)) : ""); } } -static void bamf_matcher_unregister_view (BamfMatcher *self, BamfView *view, gboolean unref); +static void bamf_matcher_unregister_view (BamfMatcher *self, BamfView *view); static gboolean emit_paths_changed (gpointer user_data) @@ -229,11 +229,11 @@ static void on_view_closed (BamfView *view, BamfMatcher *self) { - bamf_matcher_unregister_view (self, view, TRUE); + bamf_matcher_unregister_view (self, view); } static void -bamf_matcher_register_view (BamfMatcher *self, BamfView *view) +bamf_matcher_register_view_stealing_ref (BamfMatcher *self, BamfView *view) { const char *path, *type; GDBusConnection *connection; @@ -248,15 +248,14 @@ g_signal_connect (G_OBJECT (view), "active-changed", (GCallback) on_view_active_changed, self); - if (BAMF_IS_APPLICATION (view)) { bamf_matcher_prepare_path_change (self, bamf_application_get_desktop_file (BAMF_APPLICATION (view)), VIEW_ADDED); } + // This steals the reference of the view self->priv->views = g_list_prepend (self->priv->views, view); - g_object_ref (view); g_signal_emit_by_name (self, "view-opened", path, type); @@ -266,7 +265,7 @@ } static void -bamf_matcher_unregister_view (BamfMatcher *self, BamfView *view, gboolean unref) +bamf_matcher_unregister_view (BamfMatcher *self, BamfView *view) { const char * path; const char * type; @@ -279,17 +278,23 @@ g_signal_handlers_disconnect_by_func (G_OBJECT (view), on_view_closed, self); g_signal_handlers_disconnect_by_func (G_OBJECT (view), on_view_active_changed, self); - if (unref) + if (BAMF_IS_APPLICATION (view)) { - self->priv->views = g_list_remove (self->priv->views, view); + bamf_matcher_prepare_path_change (self, + bamf_application_get_desktop_file (BAMF_APPLICATION (view)), + VIEW_REMOVED); + } - if (BAMF_IS_APPLICATION (view)) - { - bamf_matcher_prepare_path_change (self, - bamf_application_get_desktop_file (BAMF_APPLICATION (view)), - VIEW_REMOVED); - } + if (self->priv->active_app == view) + self->priv->active_app = NULL; + + if (self->priv->active_win == view) + self->priv->active_win = NULL; + GList *listed_view = g_list_find (self->priv->views, view); + if (listed_view) + { + self->priv->views = g_list_delete_link (self->priv->views, listed_view); g_object_unref (view); } } @@ -789,17 +794,23 @@ desktop_file = g_desktop_app_info_new_from_filename (file); if (!G_IS_APP_INFO (desktop_file)) - return; + { + return; + } if (!g_desktop_app_info_get_show_in (desktop_file, g_getenv ("XDG_CURRENT_DESKTOP"))) - return; + { + g_object_unref (desktop_file); + return; + } exec = g_strdup (g_app_info_get_commandline (G_APP_INFO (desktop_file))); - - if (!exec) - return; - g_object_unref (desktop_file); + if (!exec) + { + g_object_unref (desktop_file); + return; + } if (exec_string_should_be_processed (self, exec)) { @@ -825,6 +836,7 @@ g_free (exec); g_string_free (desktop_id, TRUE); + g_object_unref (desktop_file); } static void @@ -901,21 +913,21 @@ directory = g_path_get_dirname (index_file); input = g_data_input_stream_new (G_INPUT_STREAM (stream)); - - while ((line = g_data_input_stream_read_line (input, &length, NULL, NULL)) != NULL) + while ((line = g_data_input_stream_read_line (input, &length, NULL, NULL))) { char *exec; char *filename; GString *desktop_id; gchar **parts = g_strsplit (line, "\t", 3); - exec = parts[1]; if (exec_string_should_be_processed (self, exec)) { char *tmp = trim_exec_string (self, exec); - exec = tmp; + g_free (parts[1]); + parts[1] = tmp; + exec = parts[1]; } filename = g_build_filename (directory, parts[0], NULL); @@ -927,6 +939,7 @@ insert_desktop_file_class_into_table (self, filename, desktop_class_table); g_string_free (desktop_id, TRUE); + g_free (line); g_free (filename); g_strfreev (parts); length = 0; @@ -970,19 +983,22 @@ if (!enumerator) continue; + info = g_file_enumerator_next_file (enumerator, NULL, NULL); - for (; info; info = g_file_enumerator_next_file (enumerator, NULL, NULL)) + + while (info) { - if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY) - continue; - - subpath = g_build_filename (path, g_file_info_get_name (info), NULL); - /* append after the current list item for non-recursive recursion love - * and to keep the priorities (hierarchy) of the .desktop directories. - */ - dirs = g_list_insert_before (dirs, l->next, subpath); + if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) + { + /* append after the current list item for non-recursive recursion love + * and to keep the priorities (hierarchy) of the .desktop directories. + */ + subpath = g_build_filename (path, g_file_info_get_name (info), NULL); + dirs = g_list_insert_before (dirs, l->next, subpath); + } g_object_unref (info); + info = g_file_enumerator_next_file (enumerator, NULL, NULL); } g_object_unref (enumerator); @@ -1530,10 +1546,17 @@ hint = get_window_hint (window, _NET_WM_DESKTOP_FILE); const char *window_class = bamf_legacy_window_get_class_name (window); - if (hint && hint[0] != '\0' && !is_web_app_window(self, window)) + if (hint) { - desktop_files = g_list_prepend (desktop_files, hint); /* whew, hard work, didn't even have to make a copy! */ + if (hint[0] != '\0' && !is_web_app_window(self, window)) + { + desktop_files = g_list_prepend (desktop_files, hint); + } + else + { + g_free (hint); + } } else { @@ -1543,7 +1566,7 @@ if (window_class) { - char *window_class_down = g_ascii_strdown (g_strdup(window_class), -1); + char *window_class_down = g_ascii_strdown (window_class, -1); l = g_hash_table_lookup (priv->desktop_id_table, window_class_down); g_free (window_class_down); @@ -1721,8 +1744,7 @@ bamf_application_set_wmclass (best, win_class); - bamf_matcher_register_view (self, BAMF_VIEW (best)); - g_object_unref (best); + bamf_matcher_register_view_stealing_ref (self, BAMF_VIEW (best)); } g_list_free_full (possible_apps, g_free); @@ -1829,8 +1851,7 @@ */ bamfwindow = bamf_window_new (window); - bamf_matcher_register_view (self, BAMF_VIEW (bamfwindow)); - g_object_unref (bamfwindow); + bamf_matcher_register_view_stealing_ref (self, BAMF_VIEW (bamfwindow)); bamf_matcher_setup_window_state (self, bamfwindow); } @@ -1892,6 +1913,7 @@ } g_free (exec); + g_free (role); return (list ? (char *) list->data : NULL); } @@ -1931,12 +1953,9 @@ if (bamf_legacy_window_get_window_type (window) == BAMF_WINDOW_DESKTOP) { - BamfWindow *bamfwindow; - - bamfwindow = bamf_window_new (window); - bamf_matcher_register_view (self, BAMF_VIEW (bamfwindow)); - g_object_unref (bamfwindow); - + BamfWindow *bamfwindow = bamf_window_new (window); + bamf_matcher_register_view_stealing_ref (self, BAMF_VIEW (bamfwindow)); + return; } @@ -2045,8 +2064,7 @@ if (desktop_file) { best = bamf_application_new_from_desktop_file (desktop_file); - bamf_matcher_register_view (self, BAMF_VIEW (best)); - g_object_unref (best); + bamf_matcher_register_view_stealing_ref (self, BAMF_VIEW (best)); } } @@ -2062,7 +2080,7 @@ g_return_if_fail (BAMF_IS_MATCHER (self)); g_return_if_fail (BAMF_IS_INDICATOR (indicator)); - bamf_matcher_register_view (self, BAMF_VIEW (indicator)); + bamf_matcher_register_view_stealing_ref (self, BAMF_VIEW (indicator)); bamf_matcher_setup_indicator_state (self, indicator); } @@ -2804,14 +2822,11 @@ { BamfMatcher *self = (BamfMatcher *) object; BamfMatcherPrivate *priv = self->priv; - GList *l; - for (l = priv->views; l; l = l->next) + while (priv->views) { - bamf_matcher_unregister_view (self, (BamfView*)l->data, FALSE); + bamf_matcher_unregister_view (self, priv->views->data); } - g_list_free_full (priv->views, g_object_unref); - priv->views = NULL; G_OBJECT_CLASS (bamf_matcher_parent_class)->dispose (object); } @@ -2875,6 +2890,8 @@ priv->active_app = NULL; priv->active_win = NULL; + static_matcher = NULL; + G_OBJECT_CLASS (bamf_matcher_parent_class)->finalize (object); } @@ -2899,12 +2916,10 @@ BamfMatcher * bamf_matcher_get_default (void) { - static BamfMatcher *matcher; - - if (!BAMF_IS_MATCHER (matcher)) + if (!BAMF_IS_MATCHER (static_matcher)) { - matcher = (BamfMatcher *) g_object_new (BAMF_TYPE_MATCHER, NULL); + static_matcher = g_object_new (BAMF_TYPE_MATCHER, NULL); } - return matcher; + return static_matcher; } diff -Nru bamf-0.2.112/src/bamf-view.c bamf-0.2.114/src/bamf-view.c --- bamf-0.2.112/src/bamf-view.c 2012-02-17 10:58:15.000000000 +0000 +++ bamf-0.2.114/src/bamf-view.c 2012-03-23 12:14:13.000000000 +0000 @@ -388,7 +388,7 @@ bamf_view_user_visible_changed (view, user_visible); } -char * +const char * bamf_view_get_icon (BamfView *view) { g_return_val_if_fail (BAMF_IS_VIEW (view), NULL); @@ -399,12 +399,15 @@ return NULL; } -char * +const char * bamf_view_get_name (BamfView *view) { g_return_val_if_fail (BAMF_IS_VIEW (view), NULL); - return g_strdup (view->priv->name); + if (BAMF_VIEW_GET_CLASS (view)->get_name) + return BAMF_VIEW_GET_CLASS (view)->get_name (view); + + return view->priv->name; } void @@ -585,10 +588,9 @@ GDBusMethodInvocation *invocation, BamfView *view) { - char *icon = bamf_view_get_icon (view); + const char *icon = bamf_view_get_icon (view); g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", icon ? icon : "")); - g_free (icon); return TRUE; } @@ -598,10 +600,9 @@ GDBusMethodInvocation *invocation, BamfView *view) { - char *name = bamf_view_get_name (view); + const char *name = bamf_view_get_name (view); g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", name ? name : "")); - g_free (name); return TRUE; } diff -Nru bamf-0.2.112/src/bamf-view.h bamf-0.2.114/src/bamf-view.h --- bamf-0.2.112/src/bamf-view.h 2012-02-17 10:58:15.000000000 +0000 +++ bamf-0.2.114/src/bamf-view.h 2012-03-23 12:14:13.000000000 +0000 @@ -42,9 +42,10 @@ GList *names; /*< methods >*/ - const char * (*view_type) (BamfView *view); - char * (*stable_bus_name) (BamfView *view); - char * (*get_icon) (BamfView *view); + const char * (*view_type) (BamfView *view); + char * (*stable_bus_name) (BamfView *view); + const char * (*get_name) (BamfView *view); + const char * (*get_icon) (BamfView *view); /*< random stuff >*/ gboolean (* urgent_changed) (BamfView *view, gboolean urgent); @@ -97,12 +98,12 @@ gboolean bamf_view_is_urgent (BamfView *view); void bamf_view_set_urgent (BamfView *view, gboolean urgent); -char * bamf_view_get_icon (BamfView *view); +const char * bamf_view_get_icon (BamfView *view); -char * bamf_view_get_name (BamfView *view); +const char * bamf_view_get_name (BamfView *view); void bamf_view_set_name (BamfView *view, const char * name); -char * bamf_view_get_parent_path (BamfView *view); +const char * bamf_view_get_parent_path (BamfView *view); BamfView * bamf_view_get_parent (BamfView *view); void bamf_view_set_parent (BamfView *view, BamfView *parent);