forked from AuroraMiddleware/gtk
gtk-demo: Make fontrendering demo work more than once
We weren't cleaning up properly, causing the window to not close the second time it is opened. Fixes: #3019
This commit is contained in:
parent
d7c4f93c76
commit
b58bad557b
@ -21,12 +21,6 @@ static PangoContext *context;
|
|||||||
|
|
||||||
static int scale = 10;
|
static int scale = 10;
|
||||||
|
|
||||||
static void
|
|
||||||
on_destroy (gpointer data)
|
|
||||||
{
|
|
||||||
window = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_image (void)
|
update_image (void)
|
||||||
{
|
{
|
||||||
@ -251,9 +245,7 @@ do_fontrendering (GtkWidget *do_widget)
|
|||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
g_signal_connect (window, "destroy",
|
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||||
G_CALLBACK (on_destroy), NULL);
|
|
||||||
g_object_set_data_full (G_OBJECT (window), "builder", builder, g_object_unref);
|
|
||||||
font_button = GTK_WIDGET (gtk_builder_get_object (builder, "font_button"));
|
font_button = GTK_WIDGET (gtk_builder_get_object (builder, "font_button"));
|
||||||
up_button = GTK_WIDGET (gtk_builder_get_object (builder, "up_button"));
|
up_button = GTK_WIDGET (gtk_builder_get_object (builder, "up_button"));
|
||||||
down_button = GTK_WIDGET (gtk_builder_get_object (builder, "down_button"));
|
down_button = GTK_WIDGET (gtk_builder_get_object (builder, "down_button"));
|
||||||
@ -276,6 +268,8 @@ do_fontrendering (GtkWidget *do_widget)
|
|||||||
g_signal_connect (show_extents, "notify::active", G_CALLBACK (update_image), NULL);
|
g_signal_connect (show_extents, "notify::active", G_CALLBACK (update_image), NULL);
|
||||||
|
|
||||||
update_image ();
|
update_image ();
|
||||||
|
|
||||||
|
g_object_unref (builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
|
Loading…
Reference in New Issue
Block a user