~ted/indicator-appmenu/destruction-will-happen-in-time

« back to all changes in this revision

Viewing changes to src/indicator-appmenu.c

  • Committer: Ted Gould
  • Date: 2011-02-07 17:35:17 UTC
  • mfrom: (99.1.2 dont-just-remove)
  • Revision ID: ted@gould.cx-20110207173517-hk7kc3nfxy72fola
Use the destroy() function instead of just removing the entry from the hashtable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
static void dbg_bus_get_cb                                           (GObject * object,
204
204
                                                                      GAsyncResult * res,
205
205
                                                                      gpointer user_data);
 
206
static void menus_destroyed                                          (GObject * menus,
 
207
                                                                      gpointer user_data);
206
208
 
207
209
/* Unique error codes for debug interface */
208
210
enum {
780
782
        BamfWindow * window = BAMF_WINDOW(view);
781
783
        guint32 xid = bamf_window_get_xid(window);
782
784
 
 
785
        /* See if it's in our list of desktop windows, if
 
786
           so remove it from that list. */
783
787
        if (bamf_window_get_window_type(window) == BAMF_WINDOW_DESKTOP) {
784
788
                g_hash_table_remove(iapp->desktop_windows, GUINT_TO_POINTER(xid));
785
789
        }
786
 
        else {
787
 
                g_debug("Window removed for window: %d", xid);
788
 
                g_hash_table_remove(iapp->apps, GUINT_TO_POINTER(xid));
 
790
 
 
791
        /* Now let's see if we've got a WM object for it then
 
792
           we need to mark it as destroyed and unreference to
 
793
           actually destroy it. */
 
794
        gpointer wm = g_hash_table_lookup(iapp->apps, GUINT_TO_POINTER(xid));
 
795
        if (wm != NULL) {
 
796
                GObject * wmo = G_OBJECT(wm);
 
797
 
 
798
                /* Using destroyed so that if the menus are shown
 
799
                   they'll be switch and the current window gets
 
800
                   updated as well. */
 
801
                menus_destroyed(wmo, iapp);
 
802
                g_object_unref(wmo);
789
803
        }
790
804
 
791
805
        return;