[gtk+/saved/mir: 25/47] mir: we must leak the window ref for now



commit 098881dbe4dfdcb60e509c0b3cc62f62c73d11b9
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed May 28 15:24:15 2014 +0200

    mir: we must leak the window ref for now
    
    By the time we get the call to ensure_no_surface() the window is already
    being disposed and the qdata is gone.  Our attempt to free the copy of
    the ref owned by Mir by looking it up again from our qdata will fail.

 gdk/mir/gdkmireventsource.c |    2 ++
 gdk/mir/gdkmirwindowimpl.c  |   11 +++--------
 2 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c
index 5be955d..c1b7feb 100644
--- a/gdk/mir/gdkmireventsource.c
+++ b/gdk/mir/gdkmireventsource.c
@@ -681,6 +681,8 @@ gdk_mir_event_source_convert_events (GdkMirEventSource *source)
        */
       if (window != NULL)
         gdk_mir_event_source_queue_event (source->display, window, &event->event);
+      else
+        g_warning ("window was destroyed before event arrived...");
 
       gdk_mir_queued_event_free (event);
     }
diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c
index 5ed96db..79dbe73 100644
--- a/gdk/mir/gdkmirwindowimpl.c
+++ b/gdk/mir/gdkmirwindowimpl.c
@@ -86,7 +86,9 @@ ensure_surface (GdkWindow *window)
   if (impl->surface)
     return;
 
-  /* no destroy notify: see below... */
+  /* no destroy notify -- we must leak for now
+   * https://bugs.launchpad.net/mir/+bug/1324100
+   */
   event_delegate.context = _gdk_mir_event_source_get_window_reference (window);
 
   // Should probably calculate this once?
@@ -116,13 +118,6 @@ ensure_no_surface (GdkWindow *window)
   GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
   GdkMirWindowReference *window_ref;
 
-  /* hack: no destroy notify on the mir surface, so we have to grab it
-   * from ourselves again...
-   */
-  window_ref = _gdk_mir_event_source_get_window_reference (window);
-  _gdk_mir_window_reference_unref (window_ref);
-  _gdk_mir_window_reference_unref (window_ref);
-
   if (impl->cairo_surface)
     {
       cairo_surface_finish (impl->cairo_surface);


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