[mutter/wip/rstrode/rhel-8.0.0: 27/117] window: Return -1 if meta_window_get_monitor is called on an unmanaged window



commit f607df49eccbe875c7b62983aa4bcbac8adb8661
Author: Sam Spilsbury <sam endlessm com>
Date:   Tue Oct 10 16:39:40 2017 +0000

    window: Return -1 if meta_window_get_monitor is called on an unmanaged window
    
    As opposed to crashing. In this case, letting the caller deal with
    it is the best policy, since this is public API.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788834
    
    (cherry picked from commit 8626c69c2ffa806f854041a3738340c6fb20c112)

 src/core/window.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index d69720a4d..e68f5245c 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -3752,11 +3752,15 @@ maybe_move_attached_dialog (MetaWindow *window,
  *
  * Gets index of the monitor that this window is on.
  *
- * Return Value: The index of the monitor in the screens monitor list
+ * Return Value: The index of the monitor in the screens monitor list, or -1
+ * if the window has been recently unmanaged and does not have a monitor.
  */
 int
 meta_window_get_monitor (MetaWindow *window)
 {
+  if (!window->monitor)
+    return -1;
+
   return window->monitor->number;
 }
 


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