diff options
author | Colomban Wendling <[email protected]> | 2022-06-07 18:49:00 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2022-07-21 19:33:52 +0200 |
commit | 8b45333cf79c4f15f2a9244239cc8274659c9eed (patch) | |
tree | d028ffeb2b6baf0f9727c789b6f33b953a57e79d | |
parent | 625b317a67e37e02292b1775157b1c1d12eb103c (diff) | |
download | caja-8b45333cf79c4f15f2a9244239cc8274659c9eed.tar.bz2 caja-8b45333cf79c4f15f2a9244239cc8274659c9eed.tar.xz |
caja-file-conflict-dialog: Properly release references on dispose()
Fixes #1630.
-rw-r--r-- | libcaja-private/caja-file-conflict-dialog.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/libcaja-private/caja-file-conflict-dialog.c b/libcaja-private/caja-file-conflict-dialog.c index b0247848..f16717f3 100644 --- a/libcaja-private/caja-file-conflict-dialog.c +++ b/libcaja-private/caja-file-conflict-dialog.c @@ -672,33 +672,45 @@ caja_file_conflict_dialog_init (CajaFileConflictDialog *fcd) } static void -do_finalize (GObject *self) +do_dispose (GObject *self) { CajaFileConflictDialogPrivate *details = CAJA_FILE_CONFLICT_DIALOG (self)->details; - g_free (details->conflict_name); - if (details->handle != NULL) { caja_file_list_cancel_call_when_ready (details->handle); + details->handle = NULL; } if (details->src_handler_id) { g_signal_handler_disconnect (details->source, details->src_handler_id); caja_file_monitor_remove (details->source, self); + details->src_handler_id = 0; } if (details->dest_handler_id) { g_signal_handler_disconnect (details->destination, details->dest_handler_id); caja_file_monitor_remove (details->destination, self); + details->dest_handler_id = 0; } - caja_file_unref (details->source); - caja_file_unref (details->destination); - caja_file_unref (details->dest_dir); + g_clear_pointer (&details->source, caja_file_unref); + g_clear_pointer (&details->destination, caja_file_unref); + g_clear_pointer (&details->dest_dir, caja_file_unref); + + G_OBJECT_CLASS (caja_file_conflict_dialog_parent_class)->dispose (self); +} + +static void +do_finalize (GObject *self) +{ + CajaFileConflictDialogPrivate *details = + CAJA_FILE_CONFLICT_DIALOG (self)->details; + + g_free (details->conflict_name); G_OBJECT_CLASS (caja_file_conflict_dialog_parent_class)->finalize (self); } @@ -706,6 +718,7 @@ do_finalize (GObject *self) static void caja_file_conflict_dialog_class_init (CajaFileConflictDialogClass *klass) { + G_OBJECT_CLASS (klass)->dispose = do_dispose; G_OBJECT_CLASS (klass)->finalize = do_finalize; } |