Attilio Fiandrotti wrote:
> I just tested Simon's patch on gtk+ 2-10 branch and DFB 1.0 and it
> actually fixes memory leaks which oterwise would occourr when
destroying
> windows. The patch seems also to be stable: i had along GIMP session
and
> experienced no crashes. Because DirectFB >= 1.0 is needed for the
patch
> to work, i added the #ifdef's you find in this > mail's attachment
> (it's Simon's original patch with #ifdef's aded where needed).
> I think this patch should be applied also to gtk+ trunk, of course.
Sorry for bothering you again with this issue, but there is one thing
I'm
currently not sure about: before we call
gdk_directfb_event_windows_remove()
in _gdk_windowing_window_destroy() and detach from the event buffer, the
CoreWindow must already have been destroyed (otherwise we seem to lose
the
DWET_DESTROYED message that triggers the call of
gdk_window_destroy_notify().
Here is the _gdk_windowing_window_destroy() function (see comments):
void
_gdk_windowing_window_destroy (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy)
{
GdkWindowObject *private;
GdkWindowImplDirectFB *impl;
g_return_if_fail (GDK_IS_WINDOW (window));
private = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl);
_gdk_selection_window_destroyed (window);
/// With my last patch, we call it here ///
// gdk_directfb_event_windows_remove (window);
if (window == _gdk_directfb_pointer_grab_window)
gdk_pointer_ungrab (GDK_CURRENT_TIME);
if (window == _gdk_directfb_keyboard_grab_window)
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
if (window == gdk_directfb_focused_window)
gdk_directfb_change_focus (NULL);
if (impl->drawable.surface) {
GdkDrawableImplDirectFB *dimpl = GDK_DRAWABLE_IMPL_DIRECTFB
(private->impl);
if(dimpl->cairo_surface) {
cairo_surface_destroy(dimpl->cairo_surface);
dimpl->cairo_surface= NULL;
}
impl->drawable.surface->Release (impl->drawable.surface);
impl->drawable.surface = NULL;
}
if (!recursing && !foreign_destroy && impl->window ) {
impl->window->SetOpacity (impl->window,0);
impl->window->Close(impl->window);
/// Or would it be better to first destroy the window and call it here?
///
impl->window->Destroy(impl->window);
gdk_directfb_event_windows_remove (window);
impl->window->Release(impl->window);
impl->window = NULL;
}
}
What do you think?
Best regards
Simon
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev