]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix crash because xerror in get_monitor_at_window
authorOliver Kurth <okurth@vmware.com>
Tue, 17 Mar 2020 21:36:54 +0000 (14:36 -0700)
committerOliver Kurth <okurth@vmware.com>
Tue, 17 Mar 2020 21:36:54 +0000 (14:36 -0700)
Sometimes there is an x drawable error while calling get_monitor_at_window.
This error can be safely ignored.

open-vm-tools/services/plugins/dndcp/xutils/xutils.cc

index 7fcf9a0ba3a6db23ee87a8d9d2771b5e52d80bba..3fad2ce31a5e46c2df129e5bb454a90b22f8bc0d 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2008-2019 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008-2020 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -989,9 +989,15 @@ GetMonitorWorkArea(Glib::RefPtr<Gdk::Screen> screen,    // IN:
       std::vector<unsigned long> values;
       NETWMStrutPartial strut = NETWMStrutPartial();
 
+      gdk_error_trap_push();
       if (monitor != screen->get_monitor_at_window(gdkWindow)) {
          continue;
       }
+      int err = gdk_error_trap_pop();
+      if (err) {
+         Log("Ignore xerror in get_monitor_at_window. Error code %d", err);
+         continue;
+      }
 
       /*
        * The EWMH spec says that the new _NET_WM_STRUT_PARTIAL takes precedence