mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-01-30 17:12:09 -05:00
UI: Add timer to NewYouTubeAppDock()
CEF apparently doesn't like it and is unable to handle when you destroy/recreate CEF instances very quickly, so... let's just put a timer on this insanely terrible function. I guess. Whatever.
This commit is contained in:
@@ -8484,11 +8484,25 @@ YouTubeAppDock *OBSBasic::GetYouTubeAppDock()
|
||||
return youtubeAppDock;
|
||||
}
|
||||
|
||||
#ifndef SEC_TO_NSEC
|
||||
#define SEC_TO_NSEC 1000000000
|
||||
#endif
|
||||
|
||||
void OBSBasic::NewYouTubeAppDock()
|
||||
{
|
||||
if (!cef_js_avail)
|
||||
return;
|
||||
|
||||
/* make sure that the youtube app dock can't be immediately recreated.
|
||||
* dumb hack. blame chromium. or this particular dock. or both. if CEF
|
||||
* creates/destroys/creates a widget too quickly it can lead to a
|
||||
* crash. */
|
||||
uint64_t ts = os_gettime_ns();
|
||||
if ((ts - lastYouTubeAppDockCreationTime) < (5ULL * SEC_TO_NSEC))
|
||||
return;
|
||||
|
||||
lastYouTubeAppDockCreationTime = ts;
|
||||
|
||||
if (youtubeAppDock)
|
||||
RemoveDockWidget(youtubeAppDock->objectName());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user