HISE Logo Forum
    • Categories
    • Register
    • Login

    Help with: Buffer_Not_Writeable_By_vImage

    Scheduled Pinned Locked Moved General Questions
    18 Posts 2 Posters 706 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dan KorneffD
      Dan Korneff
      last edited by

      I have an exported AAX that is crashing randomly with Access Violation.
      The crash report looks like:

      	0x7fff68034f53 : - (libsystem_pthread.dylib @ 0x7fff68033000)
      	0x7fff68034c98 : - (libsystem_pthread.dylib @ 0x7fff68033000)
      	0x7fff6510b575 : - (libc++.1.dylib @ 0x7fff65103000)
      	0x1318f3392 : - (My Awesome Plugin @ 0x130bdd000)
      	0x1318f1486 : - (My Awesome Plugin @ 0x130bdd000)
      	0x1318f134a : - (My Awesome Plugin @ 0x130bdd000)
      	0x7fff2dea7884 : - (CoreFoundation @ 0x7fff2de23000)
      	0x7fff2dea7823 : - (CoreFoundation @ 0x7fff2de23000)
      	0x7fff2dea763d : - (CoreFoundation @ 0x7fff2de23000)
      	0x7fff2dea6359 : - (CoreFoundation @ 0x7fff2de23000)
      	0x7fff2dea5953 : - (CoreFoundation @ 0x7fff2de23000)
      	0x7fff2cac0abd : - (HIToolbox @ 0x7fff2ca91000)
      	0x7fff2cac07d5 : - (HIToolbox @ 0x7fff2ca91000)
      	0x7fff2cac0579 : - (HIToolbox @ 0x7fff2ca91000)
      	0x7fff2b106039 : - (AppKit @ 0x7fff2b0c5000)
      	0x7fff2b104880 : - (AppKit @ 0x7fff2b0c5000)
      	0x7fff2b0f658e : - (AppKit @ 0x7fff2b0c5000)
      	0x109f51607 : - (DFW @ 0x109d13000)
      	0x109d552da : - (DFW @ 0x109d13000)
      	0x125108620 : - (ProTools_Indigo @ 0x11ff00000)
      	0x12510f431 : - (ProTools_Indigo @ 0x11ff00000)
      	0x108c0d9c8 : - (Pro Tools @ 0x108c08000)
      	0x7fff67e30cc9 : - (libdyld.dylib @ 0x7fff67e16000)
      

      When I profile the app, I see this error:

      vImageDebug_CheckDestBuffer
      _ERROR_Buffer_Write__Too_Small_For_Arguments_To_vImage__CheckBacktrace
      _ERROR_Buffer_Not_Writeable_By_vImage__CheckBacktrace
      

      Image related? Does this ring a bell for anyone?

      Dan Korneff - Producer / Mixer / Audio Nerd

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @Dan Korneff
        last edited by

        @Dan-Korneff No, but you can compile the plugin now with debug symbols to get a better crash report:

        Link Preview Image
        HISE | Docs

        favicon

        (docs.hise.audio)

        Dan KorneffD 1 Reply Last reply Reply Quote 3
        • Dan KorneffD
          Dan Korneff @Christoph Hart
          last edited by

          @Christoph-Hart amazing! How long has this been available??

          Dan Korneff - Producer / Mixer / Audio Nerd

          Christoph HartC 1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart @Dan Korneff
            last edited by

            @Dan-Korneff it‘s a recent addition (a few weeks back) so your entire life hasn‘t been a lie :)

            Dan KorneffD 1 Reply Last reply Reply Quote 3
            • Dan KorneffD
              Dan Korneff @Christoph Hart
              last edited by

              @Christoph-Hart The debug worked great!
              This is what the Crashed thread looks like:

              Thread 0 Crashed:: Main Thread  Dispatch queue: com.apple.main-thread
              0   com.apple.CoreText            	0x00007fff3a3c3807 ConvertToMorxAsync(__CTFont const*) + 209
              1   com.apple.CoreText            	0x00007fff3a3cc28c TASCIIEncoder::Encode() + 44
              2   com.apple.CoreText            	0x00007fff3a3cbcf7 TGlyphEncoder::EncodeChars(CFRange, TAttributes const&, TGlyphEncoder::Fallbacks) + 1023
              3   com.apple.CoreText            	0x00007fff3a3cb3e1 TTypesetterAttrString::Initialize(__CFAttributedString const*) + 291
              4   com.apple.CoreText            	0x00007fff3a3cb0fd TTypesetterAttrString::TTypesetterAttrString(__CFAttributedString const*, __CFDictionary const*) + 163
              5   com.apple.CoreText            	0x00007fff3a3caf83 CTLineCreateWithAttributedString + 85
              6   com.korneffaudio.myplug       	0x0000000132f3445b juce::OSXTypeface::getGlyphPositions(juce::String const&, juce::Array<int, juce::DummyCriticalSection, 0>&, juce::Array<float, juce::DummyCriticalSection, 0>&) + 251
              7   com.korneffaudio.myplug       	0x0000000132f38d4f juce::Font::getGlyphPositions(juce::String const&, juce::Array<int, juce::DummyCriticalSection, 0>&, juce::Array<float, juce::DummyCriticalSection, 0>&) const + 63
              8   com.korneffaudio.myplug       	0x0000000132c920d0 hise::MarkdownLayout::MarkdownLayout(juce::AttributedString const&, float, std::__1::function<float (juce::Font const&, juce::String const&)> const&, bool) + 816
              9   com.korneffaudio.myplug       	0x0000000132c96962 hise::MarkdownParser::MarkdownTable::Row::updateHeight(float, float&, hise::MarkdownParser*) + 562
              10  com.korneffaudio.myplug       	0x0000000132c94b6a hise::MarkdownParser::MarkdownTable::getHeightForWidth(float) + 298
              11  com.korneffaudio.myplug       	0x0000000132ca9377 hise::MarkdownPreview::resized() + 535
              12  com.korneffaudio.myplug       	0x0000000132fa8dd4 juce::Component::sendMovedResizedMessages(bool, bool) + 196
              13  com.korneffaudio.myplug       	0x0000000132fa8dd4 juce::Component::sendMovedResizedMessages(bool, bool) + 196
              14  com.korneffaudio.myplug       	0x00000001323ad652 hise::FloatingTile::resized() + 578
              15  com.korneffaudio.myplug       	0x0000000132fa8dd4 juce::Component::sendMovedResizedMessages(bool, bool) + 196
              16  com.korneffaudio.myplug       	0x00000001327bce48 hise::ScriptContentComponent::updateContent(hise::ScriptingApi::Content::ScriptComponent*) + 296
              17  com.korneffaudio.myplug       	0x00000001327ba678 hise::ScriptContentComponent::setNewContent(hise::ScriptingApi::Content*) + 3080
              18  com.korneffaudio.myplug       	0x00000001322d16cf hise::InterfaceContentPanel::connectToScript() + 2239
              19  com.korneffaudio.myplug       	0x00000001322d07bb hise::FloatingTileContent* hise::FloatingTileContent::Factory::createFunc<hise::InterfaceContentPanel>(hise::FloatingTile*) + 251
              20  com.korneffaudio.myplug       	0x00000001325a7017 hise::FrontendProcessorEditor::FrontendProcessorEditor(hise::FrontendProcessor*) + 2231
              21  com.korneffaudio.myplug       	0x00000001325a3952 hise::FrontendProcessor::createEditor() + 34
              22  com.korneffaudio.myplug       	0x0000000132228ad1 AAXClasses::JuceAAX_GUI::CreateViewContents() + 241
              23  com.korneffaudio.myplug       	0x0000000132226dc0 AAX_CEffectGUI::Initialize(IACFUnknown*) + 108
              24  com.avid.framework.AAXHost    	0x0000000127fe1f0c AAXH_VEffectGUI::Initialize(IACFUnknown*) + 2046
              25  com.avid.framework.AAXHost    	0x0000000127f9fc6a AAXH_CEffectGUI::Initialize(IACFUnknown*) + 2410
              26  com.avid.framework.AAXHost    	0x0000000127f2d713 AAXH_CPlugIn::CreateEffectGUI() + 2683
              27  com.avid.framework.AAE        	0x0000000128bb3c66 CFicAAXWidget::SetPlugInViewContainer(SFicPlugInSpec*, IACFUnknown*) + 118
              28  com.digidesign.framework.SMgr 	0x000000012a588256 SMgr_ViewContainer::SetViewContainer(void*) + 96
              29  com.digidesign.framework.ProTools_Orange	0x0000000120503b18 TFXTDMEditView::AdjustViewForTarget() + 544
              30  com.digidesign.framework.ProTools_Orange	0x0000000120503832 TFXTDMEditView::AdjustToNewTarget() + 22
              31  com.digidesign.framework.ProTools_Orange	0x000000012052f946 TFXWindow::AdjustToNewTarget() + 6190
              32  com.digidesign.framework.ProTools_Orange	0x00000001205394c5 TFXWindow::TargetHasChanged() + 4447
              33  com.digidesign.framework.ProTools_Orange	0x000000012052c023 TFXWindow::SetTarget(Cmn_Handle2<TSoundTrack, Cmn_Handle_NoDelete<TCollabObject const> >, short, short, bool, bool) + 4391
              34  com.digidesign.framework.ProTools_Orange	0x0000000120341279 TEffectWindowMgr::OpenWindow(Cmn_Handle2<TSoundTrack, Cmn_Handle_NoDelete<TCollabObject const> >, short, short, bool, bool, bool, VPoint, bool) + 1219
              35  com.digidesign.framework.ProTools_Orange	0x000000011fc6241b TAEffectNameView::DoMouseCommand(VPoint&, TToolboxEvent*, _CPoint) + 8771
              36  com.digidesign.framework.DFW  	0x000000010719f216 TView::HandleMouseDown(VPoint const&, TToolboxEvent*, _CPoint) + 998
              37  com.digidesign.framework.DFW  	0x000000010719f010 TView::HandleMouseDown(VPoint const&, TToolboxEvent*, _CPoint) + 480
              38  com.digidesign.framework.DFW  	0x000000010719f010 TView::HandleMouseDown(VPoint const&, TToolboxEvent*, _CPoint) + 480
              39  com.digidesign.framework.DFW  	0x000000010719f010 TView::HandleMouseDown(VPoint const&, TToolboxEvent*, _CPoint) + 480
              40  com.digidesign.framework.DFW  	0x000000010719f010 TView::HandleMouseDown(VPoint const&, TToolboxEvent*, _CPoint) + 480
              41  com.digidesign.framework.ProTools_Orange	0x00000001202ec5d5 TEditTable::HandleMouseDown(VPoint const&, TToolboxEvent*, _CPoint) + 4291
              42  com.digidesign.framework.DFW  	0x000000010719f010 TView::HandleMouseDown(VPoint const&, TToolboxEvent*, _CPoint) + 480
              43  com.digidesign.framework.DFW  	0x000000010719f010 TView::HandleMouseDown(VPoint const&, TToolboxEvent*, _CPoint) + 480
              44  com.digidesign.framework.ProTools_Orange	0x0000000123468b0e TEditTimelineView::HandleMouseDown(VPoint const&, TToolboxEvent*, _CPoint) + 3902
              45  com.digidesign.framework.DFW  	0x000000010719f010 TView::HandleMouseDown(VPoint const&, TToolboxEvent*, _CPoint) + 480
              46  com.digidesign.framework.DFW  	0x000000010719f010 TView::HandleMouseDown(VPoint const&, TToolboxEvent*, _CPoint) + 480
              47  com.digidesign.framework.ProTools_Orange	0x0000000120309788 TEditWindow::HandleMouseDown(VPoint const&, TToolboxEvent*, _CPoint) + 160
              48  com.digidesign.framework.DFW  	0x00000001071aad59 -[DFW_NSView mouseDown:] + 791
              49  com.apple.AppKit              	0x00007fff35a25cd9 forwardMethod + 204
              50  com.digidesign.framework.DFW  	0x00000001071a7295 -[DFW_NSTileView mouseDown:] + 41
              51  com.apple.AppKit              	0x00007fff35a25cd9 forwardMethod + 204
              52  com.apple.AppKit              	0x00007fff35a2c5f0 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 4914
              53  com.apple.AppKit              	0x00007fff35996e21 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2612
              54  com.apple.AppKit              	0x00007fff359961c9 -[NSWindow(NSEventRouting) sendEvent:] + 349
              55  com.apple.AppKit              	0x00007fff35994554 -[NSApplication(NSEvent) sendEvent:] + 352
              56  com.digidesign.framework.DFW  	0x00000001073be7ae -[DFW_NSApplication sendEvent:] + 2570
              57  com.apple.AppKit              	0x00007fff357e15bf -[NSApplication run] + 707
              58  com.digidesign.framework.DFW  	0x00000001073c1ba7 DFW_EventLoop::RunApplicationEventLoop() + 27
              59  com.digidesign.framework.DFW  	0x00000001071c587a TApplication::Run() + 34
              60  com.digidesign.framework.ProTools_Orange	0x0000000123419836 Launch_Pro_Tools(char*, bool) + 1613
              61  com.digidesign.framework.ProTools_Orange	0x0000000123420651 LaunchProTools + 5688
              62  com.avid.ProToolsDeveloper    	0x0000000106228738 main + 5544
              63  libdyld.dylib                 	0x00007fff726fbcc9 start + 1
              

              Something to do with my Markdown Panel?

              Dan Korneff - Producer / Mixer / Audio Nerd

              Christoph HartC 1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @Dan Korneff
                last edited by

                @Dan-Korneff yes. Are you showing the panel on startup? You might want to try deferring that to show with a delay, it seems as the font rendering isn‘t ready yet (for whatever reason).

                Dan KorneffD 3 Replies Last reply Reply Quote 0
                • Dan KorneffD
                  Dan Korneff @Christoph Hart
                  last edited by Dan Korneff

                  @Christoph-Hart it's not being displayed at startup, but the panel is being dynamically resized to fit the plugin dimensions.

                  EDIT: The Crash log above happened when I was dragging the plugin to a different insert.

                  Dan Korneff - Producer / Mixer / Audio Nerd

                  1 Reply Last reply Reply Quote 0
                  • Dan KorneffD
                    Dan Korneff @Christoph Hart
                    last edited by Dan Korneff

                    @Christoph-Hart Here's the crash log that contains the random crashes I've been experiencing:

                    BUG IN CLIENT OF LIBPLATFORM: Unlock of an os_unfair_lock not owned by current thread

                    Crashed Thread:        0  Main Thread  Dispatch queue: com.apple.main-thread
                    
                    Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
                    Exception Codes:       0x0000000000000001, 0x0000000000000000
                    Exception Note:        EXC_CORPSE_NOTIFY
                    
                    Termination Signal:    Illegal instruction: 4
                    Termination Reason:    Namespace SIGNAL, Code 0x4
                    Terminating Process:   exc handler [1990]
                    
                    Application Specific Information:
                    dyld: in dladdr()
                    BUG IN CLIENT OF LIBPLATFORM: Unlock of an os_unfair_lock not owned by current thread
                    
                    Thread 0 Crashed:: Main Thread  Dispatch queue: com.apple.main-thread
                    0   libsystem_platform.dylib      	0x00007fff728fb655 _os_unfair_lock_unowned_abort + 23
                    1   libsystem_platform.dylib      	0x00007fff728f6aaf _os_unfair_lock_unlock_slow + 105
                    2   libsystem_pthread.dylib       	0x00007fff728fff53 _pthread_cond_check_init_slow + 206
                    3   libsystem_pthread.dylib       	0x00007fff728ffc98 pthread_cond_broadcast + 55
                    4   libc++.1.dylib                	0x00007fff6f9d6575 std::__1::condition_variable::notify_all() + 9
                    5   com.korneffaudio.myplug       	0x0000000141263052 juce::MessageManager::Lock::BlockingMessage::messageCallback() + 98
                    6   com.korneffaudio.myplug       	0x0000000141261146 juce::MessageQueue::deliverNextMessage() + 246
                    7   com.korneffaudio.myplug       	0x0000000141260ffe juce::MessageQueue::runLoopSourceCallback(void*) + 14
                    8   com.apple.CoreFoundation      	0x00007fff38592884 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
                    9   com.apple.CoreFoundation      	0x00007fff38592823 __CFRunLoopDoSource0 + 103
                    10  com.apple.CoreFoundation      	0x00007fff3859263d __CFRunLoopDoSources0 + 209
                    11  com.apple.CoreFoundation      	0x00007fff38591359 __CFRunLoopRun + 937
                    12  com.apple.CoreFoundation      	0x00007fff38590953 CFRunLoopRunSpecific + 466
                    13  com.apple.HIToolbox           	0x00007fff371ababd RunCurrentEventLoopInMode + 292
                    14  com.apple.HIToolbox           	0x00007fff371ab7d5 ReceiveNextEventCommon + 584
                    15  com.apple.HIToolbox           	0x00007fff371ab579 _BlockUntilNextEventMatchingListInModeWithFilter + 64
                    16  com.apple.AppKit              	0x00007fff357f1039 _DPSNextEvent + 883
                    17  com.apple.AppKit              	0x00007fff357ef880 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
                    18  com.apple.AppKit              	0x00007fff357e158e -[NSApplication run] + 658
                    19  com.digidesign.framework.DFW  	0x0000000102b27ba7 DFW_EventLoop::RunApplicationEventLoop() + 27
                    20  com.digidesign.framework.DFW  	0x000000010292b87a TApplication::Run() + 34
                    21  com.digidesign.framework.ProTools_Orange	0x000000011e6b5836 Launch_Pro_Tools(char*, bool) + 1613
                    22  com.digidesign.framework.ProTools_Orange	0x000000011e6bc651 LaunchProTools + 5688
                    23  com.avid.ProToolsDeveloper    	0x0000000101997738 main + 5544
                    24  libdyld.dylib                 	0x00007fff726fbcc9 start + 1
                    
                    

                    Found this:
                    https://forum.juce.com/t/race-condition-i-e-crash-in-messagemanager-lock-with-fix/55870/4

                    And the fix:
                    https://github.com/juce-framework/JUCE/commit/33e81616ade84f40ccfec662c167b1b8dc772640

                    What do you suggest?

                    Dan Korneff - Producer / Mixer / Audio Nerd

                    1 Reply Last reply Reply Quote 1
                    • Dan KorneffD
                      Dan Korneff @Christoph Hart
                      last edited by

                      @Christoph-Hart should I try to cherry pick this JUCE commit? I'm not sure how different the message system is between 6 and 7....

                      Dan Korneff - Producer / Mixer / Audio Nerd

                      Christoph HartC 1 Reply Last reply Reply Quote 0
                      • Christoph HartC
                        Christoph Hart @Dan Korneff
                        last edited by

                        @Dan-Korneff nice find! Yes, please try to cherry pick this, if it works, it would be awesome.

                        Dan KorneffD 1 Reply Last reply Reply Quote 0
                        • Dan KorneffD
                          Dan Korneff @Christoph Hart
                          last edited by

                          @Christoph-Hart I tried.. 😖

                          HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(295,22): error C2065: 'lock': undeclared identifier (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
                          
                          HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(300,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
                          
                          HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(300,26): error C2146: syntax error: missing ';' before identifier 'scope' (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
                          
                          HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(300,26): error C2065: 'scope': undeclared identifier (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
                          
                          HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(393,22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
                          
                          HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(393,22): error C2146: syntax error: missing ';' before identifier 'scope' (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
                          
                          HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(393,22): error C2065: 'scope': undeclared identifier (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
                          
                          HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(409,22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\..\JuceLibraryCode\i
                          nclude_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
                          
                          HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(409,22): error C2146: syntax error: missing ';' before identifier 'scope' (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
                          
                          HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(409,22): error C2065: 'scope': undeclared identifier (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
                          

                          Looks a bit more involved.

                          Dan Korneff - Producer / Mixer / Audio Nerd

                          Christoph HartC 1 Reply Last reply Reply Quote 0
                          • Christoph HartC
                            Christoph Hart @Dan Korneff
                            last edited by

                            @Dan-Korneff alright, I‘ll take a look.

                            Dan KorneffD 1 Reply Last reply Reply Quote 1
                            • Dan KorneffD
                              Dan Korneff @Christoph Hart
                              last edited by

                              @Christoph-Hart greatly appreciated !

                              Dan Korneff - Producer / Mixer / Audio Nerd

                              Christoph HartC 1 Reply Last reply Reply Quote 0
                              • Christoph HartC
                                Christoph Hart @Dan Korneff
                                last edited by

                                @Dan-Korneff OK, I've manually patched the files (and I needed to pull in another class from JUCE 7 to compile), however now I'm hitting a few weird assertions that I didn't before so I'm a bit uncomfortable pushing this "fix" - it might be possible that there are other changes to JUCE 7's message handling and this would be a Frankenstein thing.

                                Christoph HartC 1 Reply Last reply Reply Quote 2
                                • Christoph HartC
                                  Christoph Hart @Christoph Hart
                                  last edited by

                                  @Christoph-Hart Following the JUCE discussion, this might be a "better" fix (in the sense that it's less intrusive than the JUCE 7 fix):

                                  https://forum.juce.com/t/blockingmessage-accessing-messagemanager-lock-that-went-out-of-scope/51901

                                  Dan KorneffD 3 Replies Last reply Reply Quote 1
                                  • Dan KorneffD
                                    Dan Korneff @Christoph Hart
                                    last edited by

                                    @Christoph-Hart I can give this a try:

                                            if (blockingMessage != nullptr)
                                             {
                                              {
                                             ScopedLock lock(blockingMessage->ownerCriticalSection);
                                                 blockingMessage->owner.set(nullptr);
                                              }
                                                 blockingMessage->releaseEvent.signal();
                                                 blockingMessage = nullptr;
                                             }
                                    

                                    Dan Korneff - Producer / Mixer / Audio Nerd

                                    1 Reply Last reply Reply Quote 0
                                    • Dan KorneffD
                                      Dan Korneff @Christoph Hart
                                      last edited by

                                      @Christoph-Hart Do you have any plans to eventually bump to JUCE 7?

                                      Dan Korneff - Producer / Mixer / Audio Nerd

                                      1 Reply Last reply Reply Quote 0
                                      • Dan KorneffD
                                        Dan Korneff @Christoph Hart
                                        last edited by Dan Korneff

                                        @Christoph-Hart Does this look right? It's throwing a bunch of errors.

                                        void MessageManager::Lock::exit() const noexcept
                                        {
                                            if (blockingMessage != nullptr)
                                            {
                                                {
                                                    ScopedLock lock(blockingMessage->ownerCriticalSection);
                                                    blockingMessage->owner.set(nullptr);
                                                }
                                                blockingMessage->releaseEvent.signal();
                                                blockingMessage = nullptr;
                                            }
                                        
                                            const ScopeGuard scope{ [&] { blockingMessage = nullptr; } };
                                        
                                            blockingMessage->stopWaiting();
                                        
                                            if (!blockingMessage->wasAcquired())
                                                return;
                                        
                                            if (auto* mm = MessageManager::instance)
                                            {
                                                jassert(mm->currentThreadHasLockedMessageManager());
                                                mm->threadWithLock = {};
                                            }
                                        }
                                        

                                        EDIT: operator error. This works:

                                        void MessageManager::Lock::exit() const noexcept
                                        {
                                            if (lockGained.compareAndSetBool (false, true))
                                            {
                                                auto* mm = MessageManager::instance;
                                        
                                                jassert (mm == nullptr || mm->currentThreadHasLockedMessageManager());
                                                lockGained.set (0);
                                        
                                                if (mm != nullptr)
                                                    mm->threadWithLock = {};
                                        
                                                if (blockingMessage != nullptr)
                                                {
                                                    {
                                                        ScopedLock lock(blockingMessage->ownerCriticalSection);
                                                        blockingMessage->owner.set(nullptr);
                                                    }
                                                    blockingMessage->releaseEvent.signal();
                                                    blockingMessage = nullptr;
                                                }
                                            }
                                        }
                                        

                                        Testing now

                                        Dan Korneff - Producer / Mixer / Audio Nerd

                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post

                                        31

                                        Online

                                        1.7k

                                        Users

                                        11.8k

                                        Topics

                                        102.8k

                                        Posts