[gtk+/wip/baedert/gtkimageview: 48/118] demo: Make sure the image_view stays alive long enough



commit c82d967363e3fa652fc0775796ea7c48a109cc4b
Author: Timm Bäder <mail baedert org>
Date:   Fri Jan 22 21:22:16 2016 +0100

    demo: Make sure the image_view stays alive long enough

 demos/gtk-demo/image_view.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/demos/gtk-demo/image_view.c b/demos/gtk-demo/image_view.c
index b41e20b..965d6a7 100644
--- a/demos/gtk-demo/image_view.c
+++ b/demos/gtk-demo/image_view.c
@@ -118,10 +118,12 @@ scrolled_check_button_active_cb (GObject *source)
                                       GTK_POLICY_ALWAYS,
                                       GTK_POLICY_ALWAYS);
       gtk_scrolled_window_set_overlay_scrolling (GTK_SCROLLED_WINDOW (scroller), FALSE);
-      gtk_widget_show (scroller);
+      g_object_ref (image_view);
       gtk_container_remove (GTK_CONTAINER (parent), image_view);
       gtk_container_add (GTK_CONTAINER (scroller), image_view);
       gtk_container_add (GTK_CONTAINER (parent), scroller);
+      gtk_widget_show (scroller);
+      g_object_unref (image_view);
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]