~hui.wang/unity-settings-daemon/unity-settings-daemon

« back to all changes in this revision

Viewing changes to gnome-settings-daemon/gsd-idle-monitor.c

  • Committer: CI bot
  • Author(s): Lars Uebernickel
  • Date: 2014-10-14 15:25:48 UTC
  • mfrom: (4054.1.7 trunk)
  • Revision ID: ps-jenkins@lists.canonical.com-20141014152548-pyeuwvxln09vgcxu
Idle monitor: fix ref counting bugs Fixes: 1380278
Approved by: Iain Lane, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
321
321
  g_slice_free (GsdIdleMonitorWatch, watch);
322
322
}
323
323
 
324
 
GdkFilterReturn
 
324
static GdkFilterReturn
325
325
xevent_filter (GdkXEvent *xevent,
326
 
               GdkEvent *event,
327
 
               GsdIdleMonitor *monitor)
 
326
               GdkEvent  *event,
 
327
               gpointer   user_data)
328
328
{
329
329
  XEvent *ev;
330
330
 
366
366
      monitor->user_active_alarm = None;
367
367
    }
368
368
 
369
 
  device_monitors[monitor->device_id] = NULL;  
 
369
  /* The device in device_monitors is cleared when the device is
 
370
   * removed. Ensure that the object is not deleted before that. */
 
371
  g_assert_null (device_monitors[monitor->device_id]);
370
372
 
371
373
  G_OBJECT_CLASS (gsd_idle_monitor_parent_class)->dispose (object);
372
374
}
828
830
  int device_id;
829
831
  char *path;
830
832
 
831
 
  g_object_ref(device);
832
833
  device_id = gdk_x11_device_get_id (device);
833
834
  monitor = gsd_idle_monitor_get_for_device (device_id);
834
835
  g_object_ref(monitor);
851
852
  g_dbus_object_manager_server_unexport (manager, path);
852
853
  g_free (path);
853
854
 
854
 
  g_object_unref(device_monitors[device_id]);
855
855
  g_clear_object (&device_monitors[device_id]);
856
856
  if (device_id == device_id_max)
857
857
    device_id_max--;
896
896
 
897
897
  g_dbus_object_manager_server_set_connection (manager, connection);
898
898
 
899
 
  gdk_window_add_filter (NULL, (GdkFilterFunc)xevent_filter, monitor);
 
899
  gdk_window_add_filter (NULL, xevent_filter, NULL);
900
900
}
901
901
 
902
902
static void
912
912
              const char      *name,
913
913
              gpointer         user_data)
914
914
{
915
 
  g_debug ("Lost or failed to acquire name %s\n", name);
 
915
  g_warning ("Lost or failed to acquire name %s\n", name);
916
916
 
917
 
  gdk_window_remove_filter (NULL, (GdkFilterFunc)xevent_filter, NULL);
918
 
  //mainloop_quit();
 
917
  gdk_window_remove_filter (NULL, xevent_filter, NULL);
919
918
}
920
919
 
921
920
static void