diff options
author | Sam Spilsbury <sam@endlessm.com> | 2017-10-11 00:39:40 +0800 |
---|---|---|
committer | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2018-04-17 22:49:29 -0500 |
commit | 067802eeec1fb9a0612877caacfd247e9ea6f011 (patch) | |
tree | 786c4a28d99d030daa539f584b0b45ea05f534f9 | |
parent | 2d80fd02e76bbe17dc52072299dda92ab88c99c0 (diff) | |
download | mutter-wip/window-invalid-monitor-fix.tar.gz |
window: Return -1 if meta_window_get_monitor is called on an unmanaged windowwip/window-invalid-monitor-fix
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
-rw-r--r-- | src/core/window.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/window.c b/src/core/window.c index 86f9d69b1..a83f99894 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -3750,11 +3750,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; } |