Below is a patch for window its a bit crufty I'm calling close to see
the even come back
and I only get one destroy event but the idea is we only call release
never destroy and its up
to directfb to destroy the window. I think we now are leaking I'll
have to review but I think this is the right design. Anyway can you
see if your bugs clear with this patch. Then we can figure out leaks.
Better to leak then to double free :)
If it works I'll put a big XXX about possible leaks and we can leak
test. I need to check the reference count when we enter the destroy
functions etc. Its not clear to me that Directfb does not silently
destroy children, anyway like I said this is closer to correct IMHO
and worth testing agianst.
Index: gdkwindow-directfb.c
===================================================================
RCS file: /cvs/directfb/gdk-directfb/gdkwindow-directfb.c,v
retrieving revision 1.110
diff -u -r1.110 gdkwindow-directfb.c
--- gdkwindow-directfb.c 13 Oct 2005 03:09:39 -0000 1.110
+++ gdkwindow-directfb.c 22 Nov 2005 14:14:57 -0000
@@ -159,7 +159,8 @@
if (impl->window)
{
gdk_directfb_window_id_table_remove (impl->dfb_id);
- impl->window->Release (impl->window);
+ /* native window resource must be release before we can finalize !*/
+ /*impl->window->Release (impl->window);*/
impl->window = NULL;
}
@@ -405,7 +406,8 @@
_gdk_window_destroy (window, FALSE);
return NULL;
}
- impl->window->SetOpacity(impl->window, 0xFF );
+ if( desc.caps != DWCAPS_INPUTONLY )
+ impl->window->SetOpacity(impl->window, 0xFF );
break;
case GDK_WINDOW_CHILD:
@@ -521,8 +523,27 @@
if (window == gdk_directfb_focused_window)
gdk_directfb_change_focus (NULL);
- if (impl->window)
- impl->window->Destroy (impl->window);
+/*
+printf( " DESTROYING WINDOW %p %p %d
parent=%p\n",window,impl->window,recursing,(GDK_WINDOW_OBJECT
(window))->parent);
+*/
+ if (!recursing && !foreign_destroy && impl->window ) {
+ impl->window->SetOpacity (impl->window,0);
+ impl->window->Close(impl->window);
+ impl->window->Release(impl->window);
+/*
+ impl->window->Destroy (impl->window);
+ impl->window = NULL;
+*/
+ }
+
+#if 0 /* let the finalizer kill it */
+ if (!recursing && !foreign_destroy)
+ {
+ if (impl->window)
+ impl->window->Destroy (impl->window);
+ impl->window = NULL;
+ }
+#endif
}
/* This function is called when the window is really gone.
@@ -530,6 +551,9 @@
void
gdk_window_destroy_notify (GdkWindow *window)
{
+/*
+printf(" gdk_window_destroy_notify %p\n",window);
+*/
g_return_if_fail (GDK_IS_WINDOW (window));
if (!GDK_WINDOW_DESTROYED (window))
@@ -539,8 +563,7 @@
_gdk_window_destroy (window, TRUE);
}
-
- g_object_unref (window);
+ g_object_unref (window);
}
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev