Bug 1335827 - Clean gtk window's surface provider before it gets destroyed. r=karlt, a=jcristau
authorLee Salzman <lsalzman@mozilla.com>
Tue, 21 Feb 2017 10:16:14 -0500
changeset 492873 61d165ab850743d67e4389de201d9110ace08ded
parent 492872 fb4e4e5f4d698e9f55efe5a798615b1cf7ae705f
child 492874 6bff957177d230950b59c95bc8d126809c71ce39
push id47617
push userbmo:rail@mozilla.com
push dateFri, 03 Mar 2017 03:42:47 +0000
reviewerskarlt, jcristau
bugs1335827
milestone52.0
Bug 1335827 - Clean gtk window's surface provider before it gets destroyed. r=karlt, a=jcristau MozReview-Commit-ID: 5Aahub11ZRF
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -722,16 +722,22 @@ nsWindow::Destroy()
 
     // It is safe to call DestroyeCompositor several times (here and
     // in the parent class) since it will take effect only once.
     // The reason we call it here is because on gtk platforms we need
     // to destroy the compositor before we destroy the gdk window (which
     // destroys the the gl context attached to it).
     DestroyCompositor();
 
+#ifdef MOZ_X11
+    // Ensure any resources assigned to the window get cleaned up first
+    // to avoid double-freeing.
+    mSurfaceProvider.CleanupResources();
+#endif
+
     ClearCachedResources();
 
     g_signal_handlers_disconnect_by_func(gtk_settings_get_default(),
                                          FuncToGpointer(theme_changed_cb),
                                          this);
 
     nsIRollupListener* rollupListener = nsBaseWidget::GetActiveRollupListener();
     if (rollupListener) {