summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2022-06-07 18:49:00 +0200
committerlukefromdc <[email protected]>2022-06-19 13:07:34 -0400
commit60b7fab5b9ad0b34414221cc68fea0ff465e5d9b (patch)
tree032e1cf1ffa297d9c3cb78928b0877f9bd04620b
parent71423391061ac599f65e513204ff549e17705049 (diff)
downloadcaja-60b7fab5b9ad0b34414221cc68fea0ff465e5d9b.tar.bz2
caja-60b7fab5b9ad0b34414221cc68fea0ff465e5d9b.tar.xz
caja-file-conflict-dialog: Properly release references on dispose()
Fixes #1630.
-rw-r--r--libcaja-private/caja-file-conflict-dialog.c25
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 233f47ae..b58fda13 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;
}