cleanup: Use g_clear_handle_id() for g_source_remove()

It makes sure we do not forget to zero the id and lets us avoid
zero checks before. We use it for all new code, lets clean up the
existing code base.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/947
This commit is contained in:
Robert Mader 2019-11-22 00:25:30 +01:00
parent 51f68f1054
commit 8e172aeecb
37 changed files with 75 additions and 211 deletions

View File

@ -310,11 +310,7 @@ cally_actor_finalize (GObject *obj)
_cally_actor_clean_action_list (cally_actor); _cally_actor_clean_action_list (cally_actor);
if (priv->action_idle_handler) g_clear_handle_id (&priv->action_idle_handler, g_source_remove);
{
g_source_remove (priv->action_idle_handler);
priv->action_idle_handler = 0;
}
if (priv->action_queue) if (priv->action_queue)
{ {

View File

@ -247,11 +247,7 @@ cally_text_finalize (GObject *obj)
/* g_object_unref (cally_text->priv->textutil); */ /* g_object_unref (cally_text->priv->textutil); */
/* cally_text->priv->textutil = NULL; */ /* cally_text->priv->textutil = NULL; */
if (cally_text->priv->insert_idle_handler) g_clear_handle_id (&cally_text->priv->insert_idle_handler, g_source_remove);
{
g_source_remove (cally_text->priv->insert_idle_handler);
cally_text->priv->insert_idle_handler = 0;
}
G_OBJECT_CLASS (cally_text_parent_class)->finalize (obj); G_OBJECT_CLASS (cally_text_parent_class)->finalize (obj);
} }

View File

@ -257,8 +257,7 @@ click_action_cancel_long_press (ClutterClickAction *action)
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action)); actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
g_source_remove (priv->long_press_id); g_clear_handle_id (&priv->long_press_id, g_source_remove);
priv->long_press_id = 0;
g_signal_emit (action, click_signals[LONG_PRESS], 0, g_signal_emit (action, click_signals[LONG_PRESS], 0,
actor, actor,
@ -373,11 +372,7 @@ on_captured_event (ClutterActor *stage,
/* disconnect the capture */ /* disconnect the capture */
g_clear_signal_handler (&priv->capture_id, priv->stage); g_clear_signal_handler (&priv->capture_id, priv->stage);
if (priv->long_press_id != 0) g_clear_handle_id (&priv->long_press_id, g_source_remove);
{
g_source_remove (priv->long_press_id);
priv->long_press_id = 0;
}
if (!clutter_actor_contains (actor, clutter_event_get_source (event))) if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
return CLUTTER_EVENT_PROPAGATE; return CLUTTER_EVENT_PROPAGATE;
@ -459,11 +454,7 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
priv->stage = NULL; priv->stage = NULL;
} }
if (priv->long_press_id != 0) g_clear_handle_id (&priv->long_press_id, g_source_remove);
{
g_source_remove (priv->long_press_id);
priv->long_press_id = 0;
}
click_action_set_pressed (action, FALSE); click_action_set_pressed (action, FALSE);
click_action_set_held (action, FALSE); click_action_set_held (action, FALSE);
@ -542,11 +533,7 @@ clutter_click_action_dispose (GObject *gobject)
g_clear_signal_handler (&priv->capture_id, priv->stage); g_clear_signal_handler (&priv->capture_id, priv->stage);
if (priv->long_press_id) g_clear_handle_id (&priv->long_press_id, g_source_remove);
{
g_source_remove (priv->long_press_id);
priv->long_press_id = 0;
}
G_OBJECT_CLASS (clutter_click_action_parent_class)->dispose (gobject); G_OBJECT_CLASS (clutter_click_action_parent_class)->dispose (gobject);
} }

View File

@ -197,8 +197,8 @@ stop_secondary_click_timeout (ClutterInputDevice *device)
{ {
if (device->ptr_a11y_data->secondary_click_timer) if (device->ptr_a11y_data->secondary_click_timer)
{ {
g_source_remove (device->ptr_a11y_data->secondary_click_timer); g_clear_handle_id (&device->ptr_a11y_data->secondary_click_timer,
device->ptr_a11y_data->secondary_click_timer = 0; g_source_remove);
g_signal_emit_by_name (device->device_manager, g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped", "ptr-a11y-timeout-stopped",
@ -511,8 +511,7 @@ stop_dwell_timeout (ClutterInputDevice *device)
{ {
if (device->ptr_a11y_data->dwell_timer) if (device->ptr_a11y_data->dwell_timer)
{ {
g_source_remove (device->ptr_a11y_data->dwell_timer); g_clear_handle_id (&device->ptr_a11y_data->dwell_timer, g_source_remove);
device->ptr_a11y_data->dwell_timer = 0;
device->ptr_a11y_data->dwell_gesture_started = FALSE; device->ptr_a11y_data->dwell_gesture_started = FALSE;
g_signal_emit_by_name (device->device_manager, g_signal_emit_by_name (device->device_manager,

View File

@ -1763,11 +1763,7 @@ clutter_text_dispose (GObject *gobject)
g_clear_signal_handler (&priv->settings_changed_id, g_clear_signal_handler (&priv->settings_changed_id,
clutter_get_default_backend ()); clutter_get_default_backend ());
if (priv->password_hint_id) g_clear_handle_id (&priv->password_hint_id, g_source_remove);
{
g_source_remove (priv->password_hint_id);
priv->password_hint_id = 0;
}
clutter_text_set_buffer (self, NULL); clutter_text_set_buffer (self, NULL);
@ -2450,8 +2446,7 @@ clutter_text_key_press (ClutterActor *actor,
if (priv->show_password_hint) if (priv->show_password_hint)
{ {
if (priv->password_hint_id != 0) g_clear_handle_id (&priv->password_hint_id, g_source_remove);
g_source_remove (priv->password_hint_id);
priv->password_hint_visible = TRUE; priv->password_hint_visible = TRUE;
priv->password_hint_id = priv->password_hint_id =

View File

@ -245,7 +245,7 @@ test_materials (TestUtilsGTestFixture *fixture,
clutter_main (); clutter_main ();
g_source_remove (idle_source); g_clear_handle_id (&idle_source, g_source_remove);
if (cogl_test_verbose ()) if (cogl_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");

View File

@ -199,7 +199,7 @@ test_multitexture (TestUtilsGTestFixture *fixture,
clutter_main (); clutter_main ();
g_source_remove (idle_source); g_clear_handle_id (&idle_source, g_source_remove);
if (cogl_test_verbose ()) if (cogl_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");

View File

@ -165,7 +165,7 @@ test_readpixels (TestUtilsGTestFixture *fixture,
clutter_actor_show (stage); clutter_actor_show (stage);
clutter_main (); clutter_main ();
g_source_remove (idle_source); g_clear_handle_id (&idle_source, g_source_remove);
/* Remove all of the actors from the stage */ /* Remove all of the actors from the stage */
clutter_actor_remove_all_children (stage); clutter_actor_remove_all_children (stage);

View File

@ -129,7 +129,7 @@ test_texture_mipmaps (TestUtilsGTestFixture *fixture,
clutter_main (); clutter_main ();
g_source_remove (idle_source); g_clear_handle_id (&idle_source, g_source_remove);
if (cogl_test_verbose ()) if (cogl_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");

View File

@ -228,7 +228,7 @@ test_texture_pixmap_x11 (TestUtilsGTestFixture *fixture,
g_clear_signal_handler (&paint_handler, state.stage); g_clear_signal_handler (&paint_handler, state.stage);
g_source_remove (idle_handler); g_clear_handle_id (&idle_handler, g_source_remove);
XFreePixmap (state.display, state.pixmap); XFreePixmap (state.display, state.pixmap);

View File

@ -249,7 +249,7 @@ test_vertex_buffer_contiguous (TestUtilsGTestFixture *fixture,
cogl_object_unref (state.material); cogl_object_unref (state.material);
cogl_object_unref (state.texture); cogl_object_unref (state.texture);
g_source_remove (idle_source); g_clear_handle_id (&idle_source, g_source_remove);
if (cogl_test_verbose ()) if (cogl_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");

View File

@ -154,7 +154,7 @@ test_vertex_buffer_interleved (TestUtilsGTestFixture *fixture,
cogl_object_unref (state.buffer); cogl_object_unref (state.buffer);
g_source_remove (idle_source); g_clear_handle_id (&idle_source, g_source_remove);
if (cogl_test_verbose ()) if (cogl_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");

View File

@ -403,7 +403,7 @@ test_viewport (TestUtilsGTestFixture *fixture,
clutter_actor_show (stage); clutter_actor_show (stage);
clutter_main (); clutter_main ();
g_source_remove (idle_source); g_clear_handle_id (&idle_source, g_source_remove);
/* Remove all of the actors from the stage */ /* Remove all of the actors from the stage */
clutter_actor_remove_all_children (stage); clutter_actor_remove_all_children (stage);

View File

@ -208,8 +208,7 @@ meta_backend_finalize (GObject *object)
g_clear_object (&priv->system_bus); g_clear_object (&priv->system_bus);
g_clear_object (&priv->upower_proxy); g_clear_object (&priv->upower_proxy);
if (priv->device_update_idle_id) g_clear_handle_id (&priv->device_update_idle_id, g_source_remove);
g_source_remove (priv->device_update_idle_id);
g_hash_table_destroy (priv->device_monitors); g_hash_table_destroy (priv->device_monitors);

View File

@ -64,11 +64,7 @@ meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch)
monitor = watch->monitor; monitor = watch->monitor;
g_object_ref (monitor); g_object_ref (monitor);
if (watch->idle_source_id) g_clear_handle_id (&watch->idle_source_id, g_source_remove);
{
g_source_remove (watch->idle_source_id);
watch->idle_source_id = 0;
}
id = watch->id; id = watch->id;
is_user_active_watch = (watch->timeout_msec == 0); is_user_active_watch = (watch->timeout_msec == 0);
@ -161,11 +157,7 @@ free_watch (gpointer data)
g_object_ref (monitor); g_object_ref (monitor);
if (watch->idle_source_id) g_clear_handle_id (&watch->idle_source_id, g_source_remove);
{
g_source_remove (watch->idle_source_id);
watch->idle_source_id = 0;
}
if (watch->notify != NULL) if (watch->notify != NULL)
watch->notify (watch->user_data); watch->notify (watch->user_data);

View File

@ -1232,8 +1232,7 @@ save_config_timeout (gpointer user_data)
static void static void
cancel_persistent_confirmation (MetaMonitorManager *manager) cancel_persistent_confirmation (MetaMonitorManager *manager)
{ {
g_source_remove (manager->persistent_timeout_id); g_clear_handle_id (&manager->persistent_timeout_id, g_source_remove);
manager->persistent_timeout_id = 0;
} }
static void static void

View File

@ -166,8 +166,7 @@ meta_cursor_renderer_native_finalize (GObject *object)
MetaCursorRendererNativePrivate *priv = MetaCursorRendererNativePrivate *priv =
meta_cursor_renderer_native_get_instance_private (renderer); meta_cursor_renderer_native_get_instance_private (renderer);
if (priv->animation_timeout_id) g_clear_handle_id (&priv->animation_timeout_id, g_source_remove);
g_source_remove (priv->animation_timeout_id);
G_OBJECT_CLASS (meta_cursor_renderer_native_parent_class)->finalize (object); G_OBJECT_CLASS (meta_cursor_renderer_native_parent_class)->finalize (object);
} }
@ -658,11 +657,7 @@ maybe_schedule_cursor_sprite_animation_frame (MetaCursorRendererNative *native,
if (!cursor_change && priv->animation_timeout_id) if (!cursor_change && priv->animation_timeout_id)
return; return;
if (priv->animation_timeout_id) g_clear_handle_id (&priv->animation_timeout_id, g_source_remove);
{
g_source_remove (priv->animation_timeout_id);
priv->animation_timeout_id = 0;
}
if (cursor_sprite && meta_cursor_sprite_is_animated (cursor_sprite)) if (cursor_sprite && meta_cursor_sprite_is_animated (cursor_sprite))
{ {

View File

@ -235,8 +235,7 @@ meta_input_device_native_free_pending_slow_key (gpointer data)
SlowKeysEventPending *slow_keys_event = data; SlowKeysEventPending *slow_keys_event = data;
clutter_event_free (slow_keys_event->event); clutter_event_free (slow_keys_event->event);
if (slow_keys_event->timer) g_clear_handle_id (&slow_keys_event->timer, g_source_remove);
g_source_remove (slow_keys_event->timer);
g_free (slow_keys_event); g_free (slow_keys_event);
} }
@ -381,11 +380,7 @@ start_bounce_keys (ClutterEvent *event,
static void static void
stop_bounce_keys (MetaInputDeviceNative *device) stop_bounce_keys (MetaInputDeviceNative *device)
{ {
if (device->debounce_timer) g_clear_handle_id (&device->debounce_timer, g_source_remove);
{
g_source_remove (device->debounce_timer);
device->debounce_timer = 0;
}
} }
static void static void
@ -656,11 +651,7 @@ start_toggle_slowkeys (MetaInputDeviceNative *device)
static void static void
stop_toggle_slowkeys (MetaInputDeviceNative *device) stop_toggle_slowkeys (MetaInputDeviceNative *device)
{ {
if (device->toggle_slowkeys_timer) g_clear_handle_id (&device->toggle_slowkeys_timer, g_source_remove);
{
g_source_remove (device->toggle_slowkeys_timer);
device->toggle_slowkeys_timer = 0;
}
} }
static void static void
@ -988,11 +979,7 @@ stop_mousekeys_move (MetaInputDeviceNative *device)
device->mousekeys_first_motion_time = 0; device->mousekeys_first_motion_time = 0;
device->mousekeys_last_motion_time = 0; device->mousekeys_last_motion_time = 0;
if (device->move_mousekeys_timer) g_clear_handle_id (&device->move_mousekeys_timer, g_source_remove);
{
g_source_remove (device->move_mousekeys_timer);
device->move_mousekeys_timer = 0;
}
} }
static void static void

View File

@ -4143,7 +4143,8 @@ meta_renderer_native_finalize (GObject *object)
{ {
g_list_free_full (renderer_native->power_save_page_flip_onscreens, g_list_free_full (renderer_native->power_save_page_flip_onscreens,
(GDestroyNotify) cogl_object_unref); (GDestroyNotify) cogl_object_unref);
g_source_remove (renderer_native->power_save_page_flip_source_id); g_clear_handle_id (&renderer_native->power_save_page_flip_source_id,
g_source_remove);
} }
g_hash_table_destroy (renderer_native->gpu_datas); g_hash_table_destroy (renderer_native->gpu_datas);

View File

@ -207,8 +207,7 @@ meta_seat_native_clear_repeat_timer (MetaSeatNative *seat)
{ {
if (seat->repeat_timer) if (seat->repeat_timer)
{ {
g_source_remove (seat->repeat_timer); g_clear_handle_id (&seat->repeat_timer, g_source_remove);
seat->repeat_timer = 0;
g_clear_object (&seat->repeat_device); g_clear_object (&seat->repeat_device);
} }
} }

View File

@ -107,8 +107,7 @@ meta_input_device_x11_finalize (GObject *object)
if (device_xi2->group_modes) if (device_xi2->group_modes)
g_array_unref (device_xi2->group_modes); g_array_unref (device_xi2->group_modes);
if (device_xi2->inhibit_pointer_query_timer) g_clear_handle_id (&device_xi2->inhibit_pointer_query_timer, g_source_remove);
g_source_remove (device_xi2->inhibit_pointer_query_timer);
#endif #endif
G_OBJECT_CLASS (meta_input_device_x11_parent_class)->finalize (object); G_OBJECT_CLASS (meta_input_device_x11_parent_class)->finalize (object);

View File

@ -799,8 +799,8 @@ meta_stage_x11_translate_event (MetaStageX11 *stage_x11,
* fallback to redrawing the full stage until the cooling * fallback to redrawing the full stage until the cooling
* off period is over. * off period is over.
*/ */
if (stage_x11->clipped_redraws_cool_off) g_clear_handle_id (&stage_x11->clipped_redraws_cool_off,
g_source_remove (stage_x11->clipped_redraws_cool_off); g_source_remove);
stage_x11->clipped_redraws_cool_off = stage_x11->clipped_redraws_cool_off =
clutter_threads_add_timeout (1000, clutter_threads_add_timeout (1000,

View File

@ -228,11 +228,7 @@ meta_shaped_texture_dispose (GObject *object)
{ {
MetaShapedTexture *stex = (MetaShapedTexture *) object; MetaShapedTexture *stex = (MetaShapedTexture *) object;
if (stex->remipmap_timeout_id) g_clear_handle_id (&stex->remipmap_timeout_id, g_source_remove);
{
g_source_remove (stex->remipmap_timeout_id);
stex->remipmap_timeout_id = 0;
}
if (stex->paint_tower) if (stex->paint_tower)
meta_texture_tower_free (stex->paint_tower); meta_texture_tower_free (stex->paint_tower);

View File

@ -144,8 +144,7 @@ remove_frame_messages_timer (MetaWindowActorX11 *actor_x11)
{ {
g_assert (actor_x11->send_frame_messages_timer != 0); g_assert (actor_x11->send_frame_messages_timer != 0);
g_source_remove (actor_x11->send_frame_messages_timer); g_clear_handle_id (&actor_x11->send_frame_messages_timer, g_source_remove);
actor_x11->send_frame_messages_timer = 0;
} }
static void static void

View File

@ -522,8 +522,7 @@ static void
ping_data_free (MetaPingData *ping_data) ping_data_free (MetaPingData *ping_data)
{ {
/* Remove the timeout */ /* Remove the timeout */
if (ping_data->ping_timeout_id != 0) g_clear_handle_id (&ping_data->ping_timeout_id, g_source_remove);
g_source_remove (ping_data->ping_timeout_id);
g_free (ping_data); g_free (ping_data);
} }
@ -990,13 +989,8 @@ meta_display_close (MetaDisplay *display,
g_clear_object (&display->gesture_tracker); g_clear_object (&display->gesture_tracker);
if (display->focus_timeout_id) g_clear_handle_id (&display->focus_timeout_id, g_source_remove);
g_source_remove (display->focus_timeout_id); g_clear_handle_id (&display->tile_preview_timeout_id, g_source_remove);
display->focus_timeout_id = 0;
if (display->tile_preview_timeout_id)
g_source_remove (display->tile_preview_timeout_id);
display->tile_preview_timeout_id = 0;
if (display->work_area_later != 0) if (display->work_area_later != 0)
meta_later_remove (display->work_area_later); meta_later_remove (display->work_area_later);
@ -1254,8 +1248,7 @@ meta_display_queue_autoraise_callback (MetaDisplay *display,
window->desc, window->desc,
meta_prefs_get_auto_raise_delay ()); meta_prefs_get_auto_raise_delay ());
if (display->autoraise_timeout_id != 0) g_clear_handle_id (&display->autoraise_timeout_id, g_source_remove);
g_source_remove (display->autoraise_timeout_id);
display->autoraise_timeout_id = display->autoraise_timeout_id =
g_timeout_add_full (G_PRIORITY_DEFAULT, g_timeout_add_full (G_PRIORITY_DEFAULT,
@ -1817,11 +1810,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
meta_display_update_cursor (display); meta_display_update_cursor (display);
if (display->grab_resize_timeout_id) g_clear_handle_id (&display->grab_resize_timeout_id, g_source_remove);
{
g_source_remove (display->grab_resize_timeout_id);
display->grab_resize_timeout_id = 0;
}
meta_topic (META_DEBUG_WINDOW_OPS, meta_topic (META_DEBUG_WINDOW_OPS,
"Grab op %u on window %s successful\n", "Grab op %u on window %s successful\n",
@ -1905,11 +1894,7 @@ meta_display_end_grab_op (MetaDisplay *display,
meta_display_update_cursor (display); meta_display_update_cursor (display);
if (display->grab_resize_timeout_id) g_clear_handle_id (&display->grab_resize_timeout_id, g_source_remove);
{
g_source_remove (display->grab_resize_timeout_id);
display->grab_resize_timeout_id = 0;
}
if (meta_is_wayland_compositor ()) if (meta_is_wayland_compositor ())
meta_display_sync_wayland_input_focus (display); meta_display_sync_wayland_input_focus (display);
@ -2138,11 +2123,7 @@ meta_display_pong_for_serial (MetaDisplay *display,
ping_data); ping_data);
/* Remove the timeout */ /* Remove the timeout */
if (ping_data->ping_timeout_id != 0) g_clear_handle_id (&ping_data->ping_timeout_id, g_source_remove);
{
g_source_remove (ping_data->ping_timeout_id);
ping_data->ping_timeout_id = 0;
}
meta_window_set_alive (ping_data->window, TRUE); meta_window_set_alive (ping_data->window, TRUE);
ping_data_free (ping_data); ping_data_free (ping_data);
@ -2624,12 +2605,8 @@ meta_display_sanity_check_timestamps (MetaDisplay *display,
void void
meta_display_remove_autoraise_callback (MetaDisplay *display) meta_display_remove_autoraise_callback (MetaDisplay *display)
{ {
if (display->autoraise_timeout_id != 0) g_clear_handle_id (&display->autoraise_timeout_id, g_source_remove);
{ display->autoraise_window = NULL;
g_source_remove (display->autoraise_timeout_id);
display->autoraise_timeout_id = 0;
display->autoraise_window = NULL;
}
} }
void void
@ -3141,8 +3118,7 @@ meta_display_update_tile_preview (MetaDisplay *display,
} }
else else
{ {
if (display->tile_preview_timeout_id > 0) g_clear_handle_id (&display->tile_preview_timeout_id, g_source_remove);
g_source_remove (display->tile_preview_timeout_id);
meta_display_update_tile_preview_timeout ((gpointer)display); meta_display_update_tile_preview_timeout ((gpointer)display);
} }
@ -3151,8 +3127,7 @@ meta_display_update_tile_preview (MetaDisplay *display,
void void
meta_display_hide_tile_preview (MetaDisplay *display) meta_display_hide_tile_preview (MetaDisplay *display)
{ {
if (display->tile_preview_timeout_id > 0) g_clear_handle_id (&display->tile_preview_timeout_id, g_source_remove);
g_source_remove (display->tile_preview_timeout_id);
display->preview_tile_mode = META_TILE_NONE; display->preview_tile_mode = META_TILE_NONE;
meta_compositor_hide_tile_preview (display->compositor); meta_compositor_hide_tile_preview (display->compositor);

View File

@ -363,11 +363,7 @@ apply_edge_resistance (MetaWindow *window,
resistance_data->timeout_edge_pos < new_pos))) resistance_data->timeout_edge_pos < new_pos)))
{ {
resistance_data->timeout_setup = FALSE; resistance_data->timeout_setup = FALSE;
if (resistance_data->timeout_id != 0) g_clear_handle_id (&resistance_data->timeout_id, g_source_remove);
{
g_source_remove (resistance_data->timeout_id);
resistance_data->timeout_id = 0;
}
} }
/* Get the range of indices in the edge array that we move past/to. */ /* Get the range of indices in the edge array that we move past/to. */
@ -784,18 +780,14 @@ meta_display_cleanup_edges (MetaDisplay *display)
edge_data->bottom_edges = NULL; edge_data->bottom_edges = NULL;
/* Cleanup the timeouts */ /* Cleanup the timeouts */
if (edge_data->left_data.timeout_setup && if (edge_data->left_data.timeout_setup)
edge_data->left_data.timeout_id != 0) g_clear_handle_id (&edge_data->left_data.timeout_id, g_source_remove);
g_source_remove (edge_data->left_data.timeout_id); if (edge_data->right_data.timeout_setup)
if (edge_data->right_data.timeout_setup && g_clear_handle_id (&edge_data->right_data.timeout_id, g_source_remove);
edge_data->right_data.timeout_id != 0) if (edge_data->top_data.timeout_setup)
g_source_remove (edge_data->right_data.timeout_id); g_clear_handle_id (&edge_data->top_data.timeout_id, g_source_remove);
if (edge_data->top_data.timeout_setup && if (edge_data->bottom_data.timeout_setup)
edge_data->top_data.timeout_id != 0) g_clear_handle_id (&edge_data->bottom_data.timeout_id, g_source_remove);
g_source_remove (edge_data->top_data.timeout_id);
if (edge_data->bottom_data.timeout_setup &&
edge_data->bottom_data.timeout_id != 0)
g_source_remove (edge_data->bottom_data.timeout_id);
g_free (display->grab_edge_resistance_data); g_free (display->grab_edge_resistance_data);
display->grab_edge_resistance_data = NULL; display->grab_edge_resistance_data = NULL;

View File

@ -180,11 +180,7 @@ meta_close_dialog_default_hide (MetaCloseDialog *dialog)
dialog_default = META_CLOSE_DIALOG_DEFAULT (dialog); dialog_default = META_CLOSE_DIALOG_DEFAULT (dialog);
if (dialog_default->child_watch_id) g_clear_handle_id (&dialog_default->child_watch_id, g_source_remove);
{
g_source_remove (dialog_default->child_watch_id);
dialog_default->child_watch_id = 0;
}
if (dialog_default->dialog_pid > -1) if (dialog_default->dialog_pid > -1)
{ {
@ -207,8 +203,7 @@ meta_close_dialog_default_finalize (GObject *object)
dialog = META_CLOSE_DIALOG_DEFAULT (object); dialog = META_CLOSE_DIALOG_DEFAULT (object);
if (dialog->child_watch_id) g_clear_handle_id (&dialog->child_watch_id, g_source_remove);
g_source_remove (dialog->child_watch_id);
if (dialog->dialog_pid > -1) if (dialog->dialog_pid > -1)
{ {

View File

@ -215,8 +215,7 @@ meta_sequence_info_new (MetaGestureTracker *tracker,
static void static void
meta_sequence_info_free (MetaSequenceInfo *info) meta_sequence_info_free (MetaSequenceInfo *info)
{ {
if (info->autodeny_timeout_id) g_clear_handle_id (&info->autodeny_timeout_id, g_source_remove);
g_source_remove (info->autodeny_timeout_id);
if (info->state == META_SEQUENCE_NONE) if (info->state == META_SEQUENCE_NONE)
meta_gesture_tracker_set_sequence_state (info->tracker, info->sequence, meta_gesture_tracker_set_sequence_state (info->tracker, info->sequence,
@ -537,11 +536,7 @@ meta_gesture_tracker_set_sequence_state (MetaGestureTracker *tracker,
return FALSE; return FALSE;
/* Unset autodeny timeout */ /* Unset autodeny timeout */
if (info->autodeny_timeout_id) g_clear_handle_id (&info->autodeny_timeout_id, g_source_remove);
{
g_source_remove (info->autodeny_timeout_id);
info->autodeny_timeout_id = 0;
}
info->state = state; info->state = state;
g_signal_emit (tracker, signals[STATE_CHANGED], 0, sequence, info->state); g_signal_emit (tracker, signals[STATE_CHANGED], 0, sequence, info->state);

View File

@ -531,12 +531,8 @@ meta_startup_notification_remove_sequence (MetaStartupNotification *sn,
g_signal_handlers_disconnect_by_func (seq, on_sequence_completed, sn); g_signal_handlers_disconnect_by_func (seq, on_sequence_completed, sn);
if (sn->startup_sequences == NULL && if (sn->startup_sequences == NULL)
sn->startup_sequence_timeout != 0) g_clear_handle_id (&sn->startup_sequence_timeout, g_source_remove);
{
g_source_remove (sn->startup_sequence_timeout);
sn->startup_sequence_timeout = 0;
}
g_signal_emit (sn, sn_signals[CHANGED], 0, seq); g_signal_emit (sn, sn_signals[CHANGED], 0, seq);
g_object_unref (seq); g_object_unref (seq);
@ -572,8 +568,7 @@ meta_startup_notification_finalize (GObject *object)
{ {
MetaStartupNotification *sn = META_STARTUP_NOTIFICATION (object); MetaStartupNotification *sn = META_STARTUP_NOTIFICATION (object);
if (sn->startup_sequence_timeout) g_clear_handle_id (&sn->startup_sequence_timeout, g_source_remove);
g_source_remove (sn->startup_sequence_timeout);
g_slist_free_full (sn->startup_sequences, g_object_unref); g_slist_free_full (sn->startup_sequences, g_object_unref);
sn->startup_sequences = NULL; sn->startup_sequences = NULL;

View File

@ -762,11 +762,7 @@ unref_later (MetaLater *later)
static void static void
destroy_later (MetaLater *later) destroy_later (MetaLater *later)
{ {
if (later->source) g_clear_handle_id (&later->source, g_source_remove);
{
g_source_remove (later->source);
later->source = 0;
}
later->func = NULL; later->func = NULL;
unref_later (later); unref_later (later);
} }

View File

@ -1430,8 +1430,7 @@ meta_window_unmanage (MetaWindow *window,
meta_verbose ("Unmanaging %s\n", window->desc); meta_verbose ("Unmanaging %s\n", window->desc);
window->unmanaging = TRUE; window->unmanaging = TRUE;
if (window->unmanage_idle_id) g_clear_handle_id (&window->unmanage_idle_id, g_source_remove);
g_source_remove (window->unmanage_idle_id);
meta_window_free_delete_dialog (window); meta_window_free_delete_dialog (window);
@ -1540,11 +1539,7 @@ meta_window_unmanage (MetaWindow *window,
invalidate_work_areas (window); invalidate_work_areas (window);
} }
if (window->sync_request_timeout_id) g_clear_handle_id (&window->sync_request_timeout_id, g_source_remove);
{
g_source_remove (window->sync_request_timeout_id);
window->sync_request_timeout_id = 0;
}
if (window->display->grab_window == window) if (window->display->grab_window == window)
meta_display_end_grab_op (window->display, timestamp); meta_display_end_grab_op (window->display, timestamp);
@ -6341,11 +6336,7 @@ update_resize (MetaWindow *window,
} }
/* Remove any scheduled compensation events */ /* Remove any scheduled compensation events */
if (window->display->grab_resize_timeout_id) g_clear_handle_id (&window->display->grab_resize_timeout_id, g_source_remove);
{
g_source_remove (window->display->grab_resize_timeout_id);
window->display->grab_resize_timeout_id = 0;
}
meta_window_get_frame_rect (window, &old); meta_window_get_frame_rect (window, &old);
@ -8226,8 +8217,7 @@ queue_focus_callback (MetaDisplay *display,
focus_data->pointer_x = pointer_x; focus_data->pointer_x = pointer_x;
focus_data->pointer_y = pointer_y; focus_data->pointer_y = pointer_y;
if (display->focus_timeout_id != 0) g_clear_handle_id (&display->focus_timeout_id, g_source_remove);
g_source_remove (display->focus_timeout_id);
display->focus_timeout_id = display->focus_timeout_id =
g_timeout_add_full (G_PRIORITY_DEFAULT, g_timeout_add_full (G_PRIORITY_DEFAULT,

View File

@ -313,7 +313,7 @@ timeline_base (TestConformSimpleFixture *fixture,
timeline_data_destroy (&data_2); timeline_data_destroy (&data_2);
timeline_data_destroy (&data_3); timeline_data_destroy (&data_3);
g_source_remove (delay_tag); g_clear_handle_id (&delay_tag, g_source_remove);
clutter_actor_destroy (stage); clutter_actor_destroy (stage);
} }

View File

@ -229,11 +229,7 @@ button_release_cb (ClutterActor *actor,
/* Stop the automatic cycling if the user want to manually control /* Stop the automatic cycling if the user want to manually control
* which shader to display */ * which shader to display */
if (timeout_id) g_clear_handle_id (&timeout_id, g_source_remove);
{
g_source_remove (timeout_id);
timeout_id = 0;
}
if (event->button.button == 1) if (event->button.button == 1)
{ {

View File

@ -739,11 +739,7 @@ window_created_cb (MetaDisplay *display,
g_signal_connect (window, "unmanaged", g_signal_connect (window, "unmanaged",
G_CALLBACK (window_unmanaged_cb), manager); G_CALLBACK (window_unmanaged_cb), manager);
if (manager->xserver_grace_period_id) g_clear_handle_id (&manager->xserver_grace_period_id, g_source_remove);
{
g_source_remove (manager->xserver_grace_period_id);
manager->xserver_grace_period_id = 0;
}
} }
static void static void

View File

@ -246,11 +246,7 @@ meta_x11_display_dispose (GObject *object)
x11_display->gdk_display = NULL; x11_display->gdk_display = NULL;
} }
if (x11_display->display_close_idle) g_clear_handle_id (&x11_display->display_close_idle, g_source_remove);
{
g_source_remove (x11_display->display_close_idle);
x11_display->display_close_idle = 0;
}
g_free (x11_display->name); g_free (x11_display->name);
x11_display->name = NULL; x11_display->name = NULL;

View File

@ -150,7 +150,7 @@ new_ice_connection (IceConn connection, IcePointer client_data, Bool opening,
{ {
input_id = GPOINTER_TO_UINT ((gpointer) *watch_data); input_id = GPOINTER_TO_UINT ((gpointer) *watch_data);
g_source_remove (input_id); g_clear_handle_id (&input_id, g_source_remove);
} }
} }

View File

@ -3843,8 +3843,7 @@ meta_window_x11_update_sync_request_counter (MetaWindow *window,
window->display->grab_latest_motion_x, window->display->grab_latest_motion_x,
window->display->grab_latest_motion_y); window->display->grab_latest_motion_y);
g_source_remove (window->sync_request_timeout_id); g_clear_handle_id (&window->sync_request_timeout_id, g_source_remove);
window->sync_request_timeout_id = 0;
/* This means we are ready for another configure; /* This means we are ready for another configure;
* no pointer round trip here, to keep in sync */ * no pointer round trip here, to keep in sync */