Bug 1335827 - Clean gtk window's surface provider before it gets destroyed. r=karlt, a=gchang
authorLee Salzman <lsalzman@mozilla.com>
Tue, 21 Feb 2017 10:16:14 -0500
changeset 376382 c2afe6af497e9e4b6510c3f5f852e300f808a728
parent 376381 53bf634de5cb7e3583956752548b63ace3058abc
child 376383 afd377db9e37dc3460f5d8acf3f7fa1af8a5f049
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt, gchang
bugs1335827
milestone53.0a2
Bug 1335827 - Clean gtk window's surface provider before it gets destroyed. r=karlt, a=gchang 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) {