mirror of
https://github.com/brl/mutter.git
synced 2025-07-07 19:31:25 +00:00
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:
@ -310,11 +310,7 @@ cally_actor_finalize (GObject *obj)
|
||||
|
||||
_cally_actor_clean_action_list (cally_actor);
|
||||
|
||||
if (priv->action_idle_handler)
|
||||
{
|
||||
g_source_remove (priv->action_idle_handler);
|
||||
priv->action_idle_handler = 0;
|
||||
}
|
||||
g_clear_handle_id (&priv->action_idle_handler, g_source_remove);
|
||||
|
||||
if (priv->action_queue)
|
||||
{
|
||||
|
@ -247,11 +247,7 @@ cally_text_finalize (GObject *obj)
|
||||
/* g_object_unref (cally_text->priv->textutil); */
|
||||
/* cally_text->priv->textutil = NULL; */
|
||||
|
||||
if (cally_text->priv->insert_idle_handler)
|
||||
{
|
||||
g_source_remove (cally_text->priv->insert_idle_handler);
|
||||
cally_text->priv->insert_idle_handler = 0;
|
||||
}
|
||||
g_clear_handle_id (&cally_text->priv->insert_idle_handler, g_source_remove);
|
||||
|
||||
G_OBJECT_CLASS (cally_text_parent_class)->finalize (obj);
|
||||
}
|
||||
|
@ -257,8 +257,7 @@ click_action_cancel_long_press (ClutterClickAction *action)
|
||||
|
||||
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
||||
|
||||
g_source_remove (priv->long_press_id);
|
||||
priv->long_press_id = 0;
|
||||
g_clear_handle_id (&priv->long_press_id, g_source_remove);
|
||||
|
||||
g_signal_emit (action, click_signals[LONG_PRESS], 0,
|
||||
actor,
|
||||
@ -373,11 +372,7 @@ on_captured_event (ClutterActor *stage,
|
||||
/* disconnect the capture */
|
||||
g_clear_signal_handler (&priv->capture_id, priv->stage);
|
||||
|
||||
if (priv->long_press_id != 0)
|
||||
{
|
||||
g_source_remove (priv->long_press_id);
|
||||
priv->long_press_id = 0;
|
||||
}
|
||||
g_clear_handle_id (&priv->long_press_id, g_source_remove);
|
||||
|
||||
if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
@ -459,11 +454,7 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
|
||||
priv->stage = NULL;
|
||||
}
|
||||
|
||||
if (priv->long_press_id != 0)
|
||||
{
|
||||
g_source_remove (priv->long_press_id);
|
||||
priv->long_press_id = 0;
|
||||
}
|
||||
g_clear_handle_id (&priv->long_press_id, g_source_remove);
|
||||
|
||||
click_action_set_pressed (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);
|
||||
|
||||
if (priv->long_press_id)
|
||||
{
|
||||
g_source_remove (priv->long_press_id);
|
||||
priv->long_press_id = 0;
|
||||
}
|
||||
g_clear_handle_id (&priv->long_press_id, g_source_remove);
|
||||
|
||||
G_OBJECT_CLASS (clutter_click_action_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
@ -197,8 +197,8 @@ stop_secondary_click_timeout (ClutterInputDevice *device)
|
||||
{
|
||||
if (device->ptr_a11y_data->secondary_click_timer)
|
||||
{
|
||||
g_source_remove (device->ptr_a11y_data->secondary_click_timer);
|
||||
device->ptr_a11y_data->secondary_click_timer = 0;
|
||||
g_clear_handle_id (&device->ptr_a11y_data->secondary_click_timer,
|
||||
g_source_remove);
|
||||
|
||||
g_signal_emit_by_name (device->device_manager,
|
||||
"ptr-a11y-timeout-stopped",
|
||||
@ -511,8 +511,7 @@ stop_dwell_timeout (ClutterInputDevice *device)
|
||||
{
|
||||
if (device->ptr_a11y_data->dwell_timer)
|
||||
{
|
||||
g_source_remove (device->ptr_a11y_data->dwell_timer);
|
||||
device->ptr_a11y_data->dwell_timer = 0;
|
||||
g_clear_handle_id (&device->ptr_a11y_data->dwell_timer, g_source_remove);
|
||||
device->ptr_a11y_data->dwell_gesture_started = FALSE;
|
||||
|
||||
g_signal_emit_by_name (device->device_manager,
|
||||
|
@ -1763,11 +1763,7 @@ clutter_text_dispose (GObject *gobject)
|
||||
g_clear_signal_handler (&priv->settings_changed_id,
|
||||
clutter_get_default_backend ());
|
||||
|
||||
if (priv->password_hint_id)
|
||||
{
|
||||
g_source_remove (priv->password_hint_id);
|
||||
priv->password_hint_id = 0;
|
||||
}
|
||||
g_clear_handle_id (&priv->password_hint_id, g_source_remove);
|
||||
|
||||
clutter_text_set_buffer (self, NULL);
|
||||
|
||||
@ -2450,8 +2446,7 @@ clutter_text_key_press (ClutterActor *actor,
|
||||
|
||||
if (priv->show_password_hint)
|
||||
{
|
||||
if (priv->password_hint_id != 0)
|
||||
g_source_remove (priv->password_hint_id);
|
||||
g_clear_handle_id (&priv->password_hint_id, g_source_remove);
|
||||
|
||||
priv->password_hint_visible = TRUE;
|
||||
priv->password_hint_id =
|
||||
|
Reference in New Issue
Block a user