I have a crash in my desktop app on Windows that seems to happen when the app is out of focus while I’m not interacting with it, but could be unrelated.
In the debugger I see that PresentationQueue::preparing is null (in juce_Direct2DHwndContext_windows.cpp:127), which leads to the crash. (Should there actually be a nullptr check in there?)
I’ve no idea what’s actually going on here and if it’s something I’m doing wrong. I’m not sure how to debug it further.
I’ve also tried to reproduce this in the DemoRunner, but without luck.
Any ideas / insights on how to investigate it?
This is the full stacktrace:
juce::ArrayBase::size() juce_ArrayBase.h:216
juce::Array::Array(const juce::Array<…> &) juce_Array.h:83
juce::RectangleList::RectangleList(const juce::RectangleList<…> &) juce_RectangleList.h:62
juce::Presentation::getPaintAreas() juce_Direct2DHwndContext_windows.cpp:75
juce::PresentationQueue::unlockBack() juce_Direct2DHwndContext_windows.cpp:127
juce::PresentationQueueLock<&juce::PresentationQueue::lockBack,&juce::PresentationQueue::unlockBack>::~PresentationQueueLock() juce_Direct2DHwndContext_windows.cpp:180
juce::PresentationQueueLock<&juce::PresentationQueue::lockBack,&juce::PresentationQueue::unlockBack>::operator=(juce::PresentationQueueLock<&juce::PresentationQueue::lockBack,&juce::PresentationQueue::unlockBack> &&) juce_Direct2DHwndContext_windows.cpp:191
juce::Direct2DHwndContext::HwndPimpl::finishFrame::<lambda_1>::operator()() juce_Direct2DHwndContext_windows.cpp:573
juce::ScopeGuard<`lambda at C:\Users\chrha\devel\danguitardaw\libs\tracktion_engine\modules\juce\modules\juce_graphics\native\juce_Direct2DHwndContext_windows.cpp:571:34'>::~ScopeGuard() juce_ScopeGuard.h:64
juce::Direct2DHwndContext::HwndPimpl::finishFrame() juce_Direct2DHwndContext_windows.cpp:578
juce::Direct2DGraphicsContext::endFrame() juce_Direct2DGraphicsContext_windows.cpp:922
juce::D2DContext::handleDirect2DPaint() juce_Windowing_windows.cpp:4792
juce::D2DContext::onVBlank() juce_Windowing_windows.cpp:4737
juce::HWNDComponentPeer::onVBlank() juce_Windowing_windows.cpp:1953
juce::VBlankThread::handleAsyncUpdate() juce_VBlank_windows.cpp:143
juce::AsyncUpdater::AsyncUpdaterMessage::messageCallback() juce_AsyncUpdater.cpp:46
juce::InternalMessageQueue::dispatchMessage(juce::MessageManager::MessageBase *) juce_Messaging_windows.cpp:203
juce::InternalMessageQueue::dispatchMessages() juce_Messaging_windows.cpp:245
juce::InternalMessageQueue::dispatchNextMessage(bool) juce_Messaging_windows.cpp:130
juce::detail::dispatchNextMessageOnSystemQueue(bool) juce_Messaging_windows.cpp:274
juce::MessageManager::runDispatchLoop() juce_MessageManager.cpp:124
juce::JUCEApplicationBase::main() juce_ApplicationBase.cpp:277
WinMain(danguitar_daw::HINSTANCE__ *, danguitar_daw::HINSTANCE__ *, char *, int) Main.cpp:253
reuk
August 22, 2024, 4:43pm
2
What JUCE version are you using? There were some changes in this area between 8.0.0 and 8.0.1.
Interesting, I’m using Tracktion Engine and tracking the JUCE submodule from there. And I actually just updated. So now I’m on JUCE 8.0.1. I didn’t have any issues before the update, which was 8.0.0.
I just tried out the latest commit on the develop branch now.
I cannot reproduce the original crash, but I now have a crash that seems related. I can reliably reproduce it on my machine (Windows 11) by following these steps:
run the DemoRunner
leave the machine until the screen automatically turns off
wait 10 seconds or more
move the mouse to turn the screen back on
now the program has crashed with the following stack trace:
Exception 0xc0000005 encountered at address 0x7ff9a927270c: Access violation reading location 0x00000010
<unknown> 0x00007ff9ab4a270c
juce::PresentationQueue::lockBack() juce_Direct2DHwndContext_windows.cpp:101
juce::PresentationQueueLock<&juce::PresentationQueue::lockBack,&juce::PresentationQueue::unlockBack>::PresentationQueueLock(juce::PresentationQueue &) juce_Direct2DHwndContext_windows.cpp:177
juce::Direct2DHwndContext::HwndPimpl::SwapChainThread::getFreshPresentation() juce_Direct2DHwndContext_windows.cpp:238
juce::Direct2DHwndContext::HwndPimpl::checkPaintReady() juce_Direct2DHwndContext_windows.cpp:396
juce::Direct2DGraphicsContext::Pimpl::startFrame(float) juce_Direct2DGraphicsContext_windows.cpp:602
juce::Direct2DHwndContext::HwndPimpl::startFrame(float) juce_Direct2DHwndContext_windows.cpp:510
juce::Direct2DGraphicsContext::startFrame(float) juce_Direct2DGraphicsContext_windows.cpp:879
juce::D2DRenderContext::WrappedD2DHwndContext::startFrame(float) juce_Windowing_windows.cpp:5218
juce::D2DRenderContext::handleDirect2DPaint() juce_Windowing_windows.cpp:5499
juce::D2DRenderContext::onVBlank() juce_Windowing_windows.cpp:5123
juce::HWNDComponentPeer::onVBlank() juce_Windowing_windows.cpp:1952
juce::VBlankThread::handleAsyncUpdate() juce_VBlank_windows.cpp:149
juce::AsyncUpdater::AsyncUpdaterMessage::messageCallback() juce_AsyncUpdater.cpp:46
juce::InternalMessageQueue::dispatchMessage(juce::MessageManager::MessageBase *) juce_Messaging_windows.cpp:203
juce::InternalMessageQueue::dispatchMessages() juce_Messaging_windows.cpp:245
juce::InternalMessageQueue::dispatchNextMessage(bool) juce_Messaging_windows.cpp:130
juce::detail::dispatchNextMessageOnSystemQueue(bool) juce_Messaging_windows.cpp:274
juce::MessageManager::runDispatchLoop() juce_MessageManager.cpp:124
juce::JUCEApplicationBase::main() juce_ApplicationBase.cpp:277
WinMain(HINSTANCE__ *, HINSTANCE__ *, char *, int) Main.cpp:181
EDIT: In Direct2DHwndContext::HwndPimpl::checkPaintReady() (line 396) the swapChainThread is null.
reuk
September 10, 2024, 10:24am
5
Thanks for reporting. I can repro the issue, so hopefully we’ll have a fix available shortly.
1 Like
reuk
September 18, 2024, 4:53pm
6
It took a bit longer than I expected, but a fix is now available. Thanks for your patience!
committed 02:44PM - 18 Sep 24 UTC