-
-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix script-related crashes on exiting a domain #1251
Conversation
blockingCall ? Qt::BlockingQueuedConnection : Qt::QueuedConnection); | ||
// Lambda is necessary there to keep shared_ptr counter above zero | ||
QMetaObject::invokeMethod(this, [=, manager = shared_from_this()]{ | ||
manager->unloadAllEntityScripts(blockingCall ? Qt::BlockingQueuedConnection : Qt::QueuedConnection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this takes in a bool, should it just pass blockingCall?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually I guess to get the same behavior, the invoke needs to be blocking or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for spotting this! I'll have a fix soon.
I'll also take a look how it's used, since blocking call invoked from main thread often means a deadlock. I might add an assert or warning there too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed :)
Crashes were caused by script engine getting deleted while the invoke call was waiting to be processed. Capturing shared_ptr with lambda prevents that and pointer gets released after the lambda gets processed.
Fixes #1245