summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2022-06-07 18:49:00 +0200
committerLuke from DC <[email protected]>2022-06-08 00:42:02 +0000
commit7e110ff93a2d6c89f87a4bbb79adf4d9a33c19d0 (patch)
treec017d95f7bfee431de3e4ebde851c7c98a666f32
parentc389503d0b9ce61aefb178c16baea12f8b62d49b (diff)
downloadcaja-7e110ff93a2d6c89f87a4bbb79adf4d9a33c19d0.tar.bz2
caja-7e110ff93a2d6c89f87a4bbb79adf4d9a33c19d0.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;
}