GNOME Bugzilla – Bug 597435
[PATCH] Crash when using interactive mode to take a screenshot of the active window
Last modified: 2011-06-13 20:22:32 UTC
When using interactive mode to take a screenshot of the active window with a null delay, it results in a crash with the X BadWindow error. From what I was able to understand, this happens because the window manager / Xserver does not update the active window quickly enough, so the detected active window is some garbage, then calling find_wm_window crashes. Emmanuele Bassi was able to confirm this.
Also reported here: https://bugzilla.redhat.com/show_bug.cgi?id=541006
Created attachment 148419 [details] [review] a patch Here is a patch that fixes it. Just checking GDK_WINDOW_DESTROYED would be sufficient, actually.
This patch fixes the crash but the behaviour is weird : while the user selected the option to grab the active window, it grabs the desktop. Personally, I would expect to have the next focused window grabbed.
A timeout of 0 is really just a pathological corner case. I would not worry too much about it. What might be nicer than the timeout business altogether would be to simply wait for the user to activate another window, and take a screenshot of that, regardless of how long it takes.
I fixed this in git master now.
*** Bug 648790 has been marked as a duplicate of this bug. ***
*** Bug 649306 has been marked as a duplicate of this bug. ***