Running window calls in the main thread seems to fix dead-lock issues.

This commit is contained in:
Martín Lucas Golini
2024-11-17 02:34:05 -03:00
parent 103ec3a894
commit 6d2bcc8dd6
2 changed files with 10 additions and 10 deletions

View File

@@ -3709,15 +3709,13 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe
mUISceneNode->runOnMainThread( [path, initialPosition, this] {
loadFileFromPathOrFocus( path, true, nullptr,
getForcePositionFn( initialPosition ) );
} );
if ( !mWindow->hasFocus() ) {
if ( mWindow->isMinimized() ) {
// FIXME: SDL2 seems to very rarely dead-lock on SDL_RestoreWindow call.
// This can create a dead-lock for the file system listener.
mThreadPool->run( [this] { mWindow->restore(); } );
if ( !mWindow->hasFocus() ) {
if ( mWindow->isMinimized() )
mWindow->restore();
mWindow->raise();
}
mWindow->raise();
}
} );
}
FileSystem::fileRemove( fi.getFilepath() );
} );