1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed a dead-lock which could occur if an OpenGLContext was created and immedietely deleted before it had a chance to render

This commit is contained in:
hogliux 2017-02-20 20:03:18 +00:00
parent c504875b3f
commit 327f61eacf

View file

@ -112,7 +112,14 @@ public:
{
// make sure everything has finished executing
destroying.set (1);
execute (new DoNothingWorker(), true, true);
if (workQueue.size() > 0)
{
if (! renderThread->contains (this))
resume();
execute (new DoNothingWorker(), true, true);
}
pause();
renderThread = nullptr;
@ -417,8 +424,10 @@ public:
JobStatus runJob() override
{
{
MessageLockWorker worker (*this);
// Allow the message thread to finish setting-up the context before using it..
MessageManagerLock mml (this);
MessageManagerLock mml (worker);
if (! mml.lockWasGained())
return ThreadPoolJob::jobHasFinished;
}
@ -579,6 +588,8 @@ public:
OpenGLContext::AsyncWorker::Ptr worker = (blocker != nullptr ? blocker : static_cast<OpenGLContext::AsyncWorker::Ptr&&> (workerToUse));
workQueue.add (worker);
context.triggerRepaint();
if (blocker != nullptr)
blocker->block();
}