summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-08-08 22:37:28 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-08-08 22:37:28 (GMT)
commit89d41f2629b9d98069fa7c1db70821a14da57523 (patch)
treee573172068f9a8ee50eaf4028b9cd55f404a6717 /src
parent8b17768e12ac797e06b5829ee4a4b9ab8da78954 (diff)
Fixed reference counting when switching panels.
Diffstat (limited to 'src')
-rw-r--r--src/gtkext/gtkbufferdisplay.c2
-rw-r--r--src/gtkext/gtkdisplaypanel.c3
-rw-r--r--src/gui/menus/view.c14
3 files changed, 10 insertions, 9 deletions
diff --git a/src/gtkext/gtkbufferdisplay.c b/src/gtkext/gtkbufferdisplay.c
index fccea38..f41c4e3 100644
--- a/src/gtkext/gtkbufferdisplay.c
+++ b/src/gtkext/gtkbufferdisplay.c
@@ -205,7 +205,7 @@ static void gtk_buffer_display_init(GtkBufferDisplay *display)
static void gtk_buffer_display_dispose(GtkBufferDisplay *display)
{
- g_object_unref(G_OBJECT(display->view));
+ g_clear_object(&display->view);
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 0c3a6b9..4b21d8c 100644
--- a/src/gtkext/gtkdisplaypanel.c
+++ b/src/gtkext/gtkdisplaypanel.c
@@ -231,8 +231,7 @@ static void gtk_display_panel_loaded_interface_init(GLoadedPanelInterface *iface
static void gtk_display_panel_dispose(GtkDisplayPanel *panel)
{
- if (panel->options != NULL)
- g_object_unref(G_OBJECT(panel->options));
+ g_clear_object(&panel->options);
G_OBJECT_CLASS(gtk_display_panel_parent_class)->dispose(G_OBJECT(panel));
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c
index 6f113e2..4dca039 100644
--- a/src/gui/menus/view.c
+++ b/src/gui/menus/view.c
@@ -751,8 +751,8 @@ static void change_current_view_support(unsigned int wanted)
GtkDockStation *station; /* Base du remplacement */
GLoadedContent *content; /* Contenu représenté */
GtkWidget *support; /* Nouvel afficheur généraliste*/
- GLineCursor *cursor; /* Position à transmettre */
GLoadedPanel *new; /* Panneau encapsulé */
+ GLineCursor *cursor; /* Position à transmettre */
panel = get_current_view();
@@ -764,20 +764,22 @@ static void change_current_view_support(unsigned int wanted)
g_object_unref(G_OBJECT(content));
- cursor = g_loaded_panel_get_cursor(panel);
-
gtk_dock_panel_change_active_widget(station, support);
new = G_LOADED_PANEL(get_loaded_panel_from_built_view(support));
- g_loaded_panel_set_cursor(new, cursor);
+ cursor = g_loaded_panel_get_cursor(panel);
+
+ if (cursor != NULL)
+ {
+ g_loaded_panel_set_cursor(new, cursor);
+ g_object_unref(G_OBJECT(cursor));
+ }
change_editor_items_current_view(new);
g_object_unref(G_OBJECT(new));
- g_object_unref(G_OBJECT(cursor));
-
g_object_unref(G_OBJECT(panel));
}