summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-08-08 23:05:12 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-08-08 23:05:12 (GMT)
commitde379f531ad5fa356b33287196f884550abd2af4 (patch)
treedf15fee4e06c5424de4b01f42baec3005e081091 /src
parent89d41f2629b9d98069fa7c1db70821a14da57523 (diff)
Updated some object destruction processes.
Diffstat (limited to 'src')
-rw-r--r--src/analysis/block.c5
-rw-r--r--src/analysis/disass/area.c9
-rw-r--r--src/analysis/disass/block.c6
-rw-r--r--src/analysis/disass/fetch.c7
-rw-r--r--src/analysis/disass/instructions.c9
-rw-r--r--src/analysis/disass/routines.c12
-rw-r--r--src/gtkext/gtkbufferdisplay.c2
-rw-r--r--src/gtkext/gtkdisplaypanel.c5
8 files changed, 34 insertions, 21 deletions
diff --git a/src/analysis/block.c b/src/analysis/block.c
index 14b2c0e..8c80177 100644
--- a/src/analysis/block.c
+++ b/src/analysis/block.c
@@ -174,8 +174,7 @@ static void g_code_block_dispose(GCodeBlock *block)
g_code_block_unlock_dest(block);
#endif
- if (block->view != NULL)
- g_object_unref(G_OBJECT(block->view));
+ g_clear_object(&block->view);
G_OBJECT_CLASS(g_code_block_parent_class)->dispose(G_OBJECT(block));
@@ -759,7 +758,7 @@ static void g_block_list_dispose(GBlockList *list)
if (list->blocks[i] != NULL)
{
g_code_block_delete_all_links(list->blocks[i]);
- g_object_unref(G_OBJECT(list->blocks[i]));
+ g_clear_object(&list->blocks[i]);
}
G_OBJECT_CLASS(g_block_list_parent_class)->dispose(G_OBJECT(list));
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c
index 65024b2..2dca001 100644
--- a/src/analysis/disass/area.c
+++ b/src/analysis/disass/area.c
@@ -1610,16 +1610,13 @@ static void g_area_collector_init(GAreaCollector *collector)
static void g_area_collector_dispose(GAreaCollector *collector)
{
if (collector->run == (run_task_fc)g_area_collector_do_compute)
- g_object_unref(G_OBJECT(collector->binary));
+ g_clear_object(&collector->binary);
else if (collector->run == (run_task_fc)g_area_collector_do_insert)
- g_object_unref(G_OBJECT(collector->info));
+ g_clear_object(&collector->info);
else if (collector->run == (run_task_fc)g_area_collector_do_fill)
- {
- if (collector->ctx != NULL)
- g_object_unref(G_OBJECT(collector->ctx));
- }
+ g_clear_object(&collector->ctx);
G_OBJECT_CLASS(g_area_collector_parent_class)->dispose(G_OBJECT(collector));
diff --git a/src/analysis/disass/block.c b/src/analysis/disass/block.c
index 5c97358..b22c547 100644
--- a/src/analysis/disass/block.c
+++ b/src/analysis/disass/block.c
@@ -150,10 +150,10 @@ static void g_basic_block_init(GBasicBlock *block)
static void g_basic_block_dispose(GBasicBlock *block)
{
- g_object_unref(G_OBJECT(block->binary));
+ g_clear_object(&block->binary);
- g_object_unref(G_OBJECT(block->first));
- g_object_unref(G_OBJECT(block->last));
+ g_clear_object(&block->first);
+ g_clear_object(&block->last);
G_OBJECT_CLASS(g_basic_block_parent_class)->dispose(G_OBJECT(block));
diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c
index f179860..ae7dbdc 100644
--- a/src/analysis/disass/fetch.c
+++ b/src/analysis/disass/fetch.c
@@ -181,12 +181,11 @@ static void g_delayed_fetching_init(GDelayedFetching *fetching)
static void g_delayed_fetching_dispose(GDelayedFetching *fetching)
{
- g_object_unref(G_OBJECT(fetching->format));
+ g_clear_object(&fetching->format);
- g_object_unref(G_OBJECT(fetching->ctx));
+ g_clear_object(&fetching->ctx);
- if (fetching->status != NULL)
- g_object_unref(G_OBJECT(fetching->status));
+ g_clear_object(&fetching->status);
G_OBJECT_CLASS(g_delayed_fetching_parent_class)->dispose(G_OBJECT(fetching));
diff --git a/src/analysis/disass/instructions.c b/src/analysis/disass/instructions.c
index 78b20d4..2dd39c5 100644
--- a/src/analysis/disass/instructions.c
+++ b/src/analysis/disass/instructions.c
@@ -139,6 +139,10 @@ static void g_instructions_study_init(GInstructionsStudy *study)
static void g_instructions_study_dispose(GInstructionsStudy *study)
{
+ g_clear_object(&study->proc);
+ g_clear_object(&study->ctx);
+ g_clear_object(&study->format);
+
G_OBJECT_CLASS(g_instructions_study_parent_class)->dispose(G_OBJECT(study));
}
@@ -188,8 +192,13 @@ GInstructionsStudy *g_instructions_study_new(GArchProcessor *proc, GProcContext
result = g_object_new(G_TYPE_INSTRUCTIONS_STUDY, NULL);
result->proc = proc;
+ g_object_ref(G_OBJECT(proc));
+
result->ctx = ctx;
+ g_object_ref(G_OBJECT(ctx));
+
result->format = format;
+ g_object_ref(G_OBJECT(format));
result->fallback = fallback;
result->begin = begin;
diff --git a/src/analysis/disass/routines.c b/src/analysis/disass/routines.c
index 4e65b77..c57b80c 100644
--- a/src/analysis/disass/routines.c
+++ b/src/analysis/disass/routines.c
@@ -150,14 +150,16 @@ static void g_routines_study_init(GRoutinesStudy *study)
static void g_routines_study_dispose(GRoutinesStudy *study)
{
- g_object_unref(G_OBJECT(study->portions));
+ g_clear_object(&study->binary);
- g_binary_format_unlock_symbols_rd(study->format);
+ g_clear_object(&study->proc);
- g_object_unref(G_OBJECT(study->format));
- g_object_unref(G_OBJECT(study->proc));
+ if (study->format != NULL)
+ g_binary_format_unlock_symbols_rd(study->format);
- g_object_unref(G_OBJECT(study->binary));
+ g_clear_object(&study->format);
+
+ g_clear_object(&study->portions);
G_OBJECT_CLASS(g_routines_study_parent_class)->dispose(G_OBJECT(study));
diff --git a/src/gtkext/gtkbufferdisplay.c b/src/gtkext/gtkbufferdisplay.c
index f41c4e3..60b1f40 100644
--- a/src/gtkext/gtkbufferdisplay.c
+++ b/src/gtkext/gtkbufferdisplay.c
@@ -207,6 +207,8 @@ static void gtk_buffer_display_dispose(GtkBufferDisplay *display)
{
g_clear_object(&display->view);
+ g_clear_object(&display->cursor);
+
G_OBJECT_CLASS(gtk_buffer_display_parent_class)->dispose(G_OBJECT(display));
}
diff --git a/src/gtkext/gtkdisplaypanel.c b/src/gtkext/gtkdisplaypanel.c
index 4b21d8c..3623ced 100644
--- a/src/gtkext/gtkdisplaypanel.c
+++ b/src/gtkext/gtkdisplaypanel.c
@@ -231,8 +231,13 @@ static void gtk_display_panel_loaded_interface_init(GLoadedPanelInterface *iface
static void gtk_display_panel_dispose(GtkDisplayPanel *panel)
{
+ g_clear_object(&panel->hadjustment);
+ g_clear_object(&panel->vadjustment);
+
g_clear_object(&panel->options);
+ g_clear_object(&panel->binary);
+
G_OBJECT_CLASS(gtk_display_panel_parent_class)->dispose(G_OBJECT(panel));
}