summaryrefslogtreecommitdiff
path: root/gtk/gtkglarea.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2014-10-30 12:08:31 +0100
committerAlexander Larsson <alexl@redhat.com>2014-10-30 12:43:03 +0100
commitad30262fef6b1977b08b4f84749183c6fbbe7fa8 (patch)
tree8bcb8455d9f3fe0d65b77cb489b1220a16726b64 /gtk/gtkglarea.c
parent5f14630b76f31c9f6c146100cb3a843ffa28db6d (diff)
downloadgtk+-ad30262fef6b1977b08b4f84749183c6fbbe7fa8.tar.gz
GtkGLArea: Always destroy context on unrealize
We had some code that tried to reuse the context over realize, but that doesn't work as we need to share with the possibly new paint context of the re-realized window.
Diffstat (limited to 'gtk/gtkglarea.c')
-rw-r--r--gtk/gtkglarea.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
index b9204f0c7a..5d4cac3203 100644
--- a/gtk/gtkglarea.c
+++ b/gtk/gtkglarea.c
@@ -247,7 +247,10 @@ gtk_gl_area_unrealize (GtkWidget *widget)
else
g_warning ("can't free framebuffer");
- gdk_gl_context_clear_current ();
+ /* Make sure to destroy if current */
+ g_object_run_dispose (G_OBJECT (priv->context));
+ g_object_unref (priv->context);
+ priv->context = NULL;
}
g_clear_error (&priv->error);
@@ -380,23 +383,11 @@ gtk_gl_area_draw (GtkWidget *widget,
}
static void
-gtk_gl_area_screen_changed (GtkWidget *widget,
- GdkScreen *old_screen)
-{
- GtkGLArea *self = GTK_GL_AREA (widget);
- GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (self);
-
- /* this will cause the context to be recreated on realize */
- g_clear_object (&priv->context);
-}
-
-static void
gtk_gl_area_class_init (GtkGLAreaClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->screen_changed = gtk_gl_area_screen_changed;
widget_class->realize = gtk_gl_area_realize;
widget_class->unrealize = gtk_gl_area_unrealize;
widget_class->size_allocate = gtk_gl_area_size_allocate;