obs-studio/plugins
jp9000 5d16e44899 linux-capture: Fix window capture crashes
The xcomposite window capture crashes were due to a few factors:
-------------------------------
1.) The source's X error handler was possibly being overwritten by
another part of the program despite us locking the display, presumably
something in Qt which isn't locking the display when pushing/popping its
own error handler (though this is not yet certain).  The source's calls
to X functions happen in the graphics thread, which is separate from the
UI thread, and it was noticed that somehow the error handler would be
overwritten almost seemingly at random, indicating that something else
in the program outside of OBS code was not locking the display while
pushing/popping the error handler.

To replicate this, make it so that the source cannot find the target
window and so it continually searches for it each video_tick call, then
resize the main OBS window continually (which causes Qt to push/pop its
own error handlers).  A crash will almost always occur due to BadWindow
despite our error handling.

2.) Calling X functions with a window ID that no longer exists,
particularly XGetWindowAttributes, in conjunction the unknown error
handler set in case #1 would cause the program to outright crash because
that error handler is programmed to crash on BadWindow for whatever
reason.  The source would call X functions without even checking if
'win' was 0.

3.) The source stored window IDs (in JSON, even if they've long since
become invalid/pointless, such as system restarts).  This is a bad
practice and will result in more cases of BadWindow.

Fixing the problem (reducing the possibility of getting BadWindow):
-------------------------------
Step 1.) Deprecate and ignore window IDs in stored settings.  Instead of
using window IDs to find the window, we now must always search the
windows and find the target window via the window name exclusively.
This helps ensure that we actually consistently have a working window
ID.

Step 2.) Do not call any X functions if the window ID is 0.

Step 3.) Reset the window ID to 0 any time the window has updated, and
make the source find the window again to ensure it still exists before
attempting to use any X functions on the window ID again.
2016-06-05 00:12:43 -07:00
..
coreaudio-encoder Update translations from Crowdin 2016-05-14 00:27:59 +02:00
decklink Update translations from Crowdin 2016-04-23 10:29:21 +02:00
image-source image-source: Don't repeat same image when randomizing 2016-05-26 12:12:35 -07:00
linux-alsa Update translations from Crowdin 2016-05-14 00:27:59 +02:00
linux-capture linux-capture: Fix window capture crashes 2016-06-05 00:12:43 -07:00
linux-jack Update translations from Crowdin 2016-04-23 10:29:21 +02:00
linux-pulseaudio linux-pulseaudio: Check for failed operations 2016-05-28 13:19:16 +02:00
linux-v4l2 Update translations from Crowdin 2016-04-23 10:29:21 +02:00
mac-avcapture Update translations from Crowdin 2016-04-24 19:55:39 +02:00
mac-capture Update translations from Crowdin 2016-04-23 10:29:21 +02:00
mac-syphon Update translations from Crowdin 2016-05-14 00:27:59 +02:00
mac-vth264 Update translations from Crowdin 2016-05-14 00:27:59 +02:00
obs-ffmpeg obs-ffmpeg: Set AVCodecContext thread_count to 0 2016-05-27 10:18:02 -07:00
obs-filters obs-filters: Change async delay filter max delay to 20 sec 2016-05-30 10:42:16 -07:00
obs-libfdk Update translations from Crowdin 2016-04-24 19:55:39 +02:00
obs-outputs obs-outputs: Remove unused variable 2016-05-26 09:10:21 -07:00
obs-qsv11 Update translations from Crowdin 2016-05-14 00:27:59 +02:00
obs-transitions Update translations from Crowdin 2016-05-14 00:27:59 +02:00
obs-x264 obs-x264: Default to CBR if no other RC specified 2016-05-26 08:13:22 -07:00
rtmp-services rtmp-services: fix url 2016-05-20 20:43:29 +02:00
text-freetype2 text-freetype2: Fix a crash if there's insufficient glyph texture space 2016-04-24 20:21:07 +02:00
win-capture win-capture: Fix VS2015 update 2 compiler error 2016-05-28 09:40:49 -07:00
win-dshow win-dshow: Update libdshowcapture to 0.5.10 2016-05-26 15:24:16 -07:00
win-mf Update translations from Crowdin 2016-05-14 00:27:59 +02:00
win-wasapi Update translations from Crowdin 2016-05-14 00:27:59 +02:00
CMakeLists.txt obs-qsv11: Add native obs-studio QSV encoder 2016-04-19 08:29:22 -07:00