1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-04 20:07:36 +00:00

record-row: Prefer g_signal_connect_object() over a plain connect()

Apparently the slice list model in the history box
rebuilds the whole list when a single new record gets added.

Additionally, the "pressed" signal gets emitted on the
GtkGestureLongPress controller even when the call button is tapped
(i.e. should not have been pressed down for longer than the required timeout).
This then causes the callback to be invoked with a disposed record row.

This commit ensures the signals get properly disconnected
even in the face of unforeseen cleanup of the record row.

Helps with https://gitlab.gnome.org/GNOME/calls/-/issues/666

Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/755>
This commit is contained in:
Evangelos Ribeiro Tzaras 2024-09-11 16:52:57 +02:00
parent f810e0a9b1
commit d9e6fb3717

View file

@ -653,12 +653,16 @@ calls_call_record_row_init (CallsCallRecordRow *self)
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (calls_call_record_row_button_press_event), self);
g_signal_connect_object (gesture, "pressed",
G_CALLBACK (calls_call_record_row_button_press_event),
self, G_CONNECT_AFTER);
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
gesture = gtk_gesture_long_press_new ();
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), TRUE);
g_signal_connect (gesture, "pressed", G_CALLBACK (on_long_pressed), self);
g_signal_connect_object (gesture, "pressed",
G_CALLBACK (on_long_pressed),
self, G_CONNECT_AFTER);
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
}