Use more g_signal_connect_object()

Most of these are probably paranoid, not bugs. I haven't done an
exhaustive review to see what really needs it: that would be
time-consuming and require significant familiarity with the Calendar
codebase. This was just a quick check. Anyway, I vote for paranoid
when it comes to using g_signal_connect() regardless. It's dangerous,
and there's no reason to ever leave a signal connected after the user
data object has been destroyed.

Fixes #423
This commit is contained in:
Michael Catanzaro
2019-09-14 23:28:42 +00:00
committed by Georges Basile Stavracas Neto
parent 9644c30eee
commit 18ae67cb59
15 changed files with 87 additions and 74 deletions
+11 -9
View File
@@ -586,15 +586,16 @@ create_row_for_alarm (GcalEvent *event,
has_sound ? "audio-volume-high-symbolic" : "audio-volume-muted-symbolic",
GTK_ICON_SIZE_BUTTON);
g_signal_connect (volume_button, "toggled", G_CALLBACK (on_sound_toggle_changed_cb), row);
g_signal_connect_object (volume_button, "toggled", G_CALLBACK (on_sound_toggle_changed_cb), row, 0);
/* Remove button */
remove_button = WID ("remove_button");
g_signal_connect (remove_button,
"clicked",
G_CALLBACK (on_remove_alarm_button_clicked),
row);
g_signal_connect_object (remove_button,
"clicked",
G_CALLBACK (on_remove_alarm_button_clicked),
row,
0);
main_box = WID ("main_box");
gtk_container_add (GTK_CONTAINER (row), main_box);
@@ -1155,10 +1156,11 @@ gcal_edit_dialog_constructed (GObject* object)
G_ACTION_GROUP (self->action_group));
/* Watch the main window and adapt the maximum size */
g_signal_connect_swapped (gtk_window_get_transient_for (GTK_WINDOW (self)),
"size-allocate",
G_CALLBACK (transient_size_allocate_cb),
self);
g_signal_connect_object (gtk_window_get_transient_for (GTK_WINDOW (self)),
"size-allocate",
G_CALLBACK (transient_size_allocate_cb),
self,
G_CONNECT_SWAPPED);
}
static void