Re: [GtkGLExt] "couldn't find weak ref" to gldrawable



On Tue, 2008-08-26 at 04:55 -0400, Braden McDaniel wrote:
> Has anyone seen this:
> 
>         GLib-GObject-WARNING **: IA__g_object_weak_unref: couldn't find weak ref 0x3abd0692e0(0x7fff9d759648)
> 
> ... as a result of this code on line 111 of gdkglcontext-x11.c?
> 
>         g_object_remove_weak_pointer (G_OBJECT (impl->gldrawable),
>                                       &gldrawable_location);

I've come to the conclusion that the usage patten of
g_object_*_weak_pointer in gdkglcontext-x11.c is broken. Note in the
above call that gldrawable_location is a local variable that will go
away just as soon as execution leaves its enclosing scope.

The attached patch fixes the problem.

-- 
Braden McDaniel                           e-mail: <braden endoframe com>
<http://endoframe.com>                    Jabber: <braden jabber org>

Index: lib/gtkglext/gdk/x11/gdkglcontext-x11.c
===================================================================
--- lib/gtkglext/gdk/x11/gdkglcontext-x11.c	(revision 3523)
+++ lib/gtkglext/gdk/x11/gdkglcontext-x11.c	(working copy)
@@ -107,9 +107,8 @@
 
   if (impl->gldrawable != NULL)
     {
-      gpointer gldrawable_location = impl->gldrawable;
       g_object_remove_weak_pointer (G_OBJECT (impl->gldrawable),
-                                    &gldrawable_location);
+                                    &impl->gldrawable);
       impl->gldrawable = NULL;
     }
 
@@ -361,18 +360,16 @@
 
   if (impl->gldrawable != NULL)
     {
-      gpointer gldrawable_location = impl->gldrawable;
       g_object_remove_weak_pointer (G_OBJECT (impl->gldrawable),
-                                    &gldrawable_location);
+                                    &impl->gldrawable);
       impl->gldrawable = NULL;
     }
 
   if (gldrawable != NULL && GDK_IS_GL_DRAWABLE (gldrawable))
     {
       impl->gldrawable = gldrawable;
-      gpointer gldrawable_location = impl->gldrawable;
-      g_object_add_weak_pointer (G_OBJECT (impl->gldrawable),
-                                 &gldrawable_location);
+      g_object_add_weak_pointer (G_OBJECT (gldrawable),
+                                 &impl->gldrawable);
     }
 }
 


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