Browse Source

fix: remove pretarget handler before window destruction

Jeremy Apthorp 6 years ago
parent
commit
f115376595
2 changed files with 9 additions and 0 deletions
  1. 8 0
      atom/browser/native_window_views.cc
  2. 1 0
      atom/browser/native_window_views.h

+ 8 - 0
atom/browser/native_window_views.cc

@@ -1216,6 +1216,14 @@ void NativeWindowViews::OnWidgetBoundsChanged(views::Widget* changed_widget,
   }
 }
 
+void NativeWindowViews::OnWidgetDestroying(views::Widget* widget) {
+#if defined(OS_LINUX)
+  aura::Window* window = GetNativeWindow();
+  if (window)
+    window->RemovePreTargetHandler(this);
+#endif
+}
+
 void NativeWindowViews::DeleteDelegate() {
   if (is_modal() && this->parent()) {
     auto* parent = this->parent();

+ 1 - 0
atom/browser/native_window_views.h

@@ -161,6 +161,7 @@ class NativeWindowViews : public NativeWindow,
   void AutoresizeBrowserView(int width_delta,
                              int height_delta,
                              NativeBrowserView* browser_view);
+  void OnWidgetDestroying(views::Widget* widget) override;
   // views::WidgetDelegate:
   void DeleteDelegate() override;
   views::View* GetInitiallyFocusedView() override;