HISE Logo Forum
    • Categories
    • Register
    • Login

    AsyncUpdater crash when adding childpanel

    Scheduled Pinned Locked Moved Bug Reports
    8 Posts 2 Posters 283 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'm running into an issue that I can't pinpoint. I'm using a factory method to add child panels to other child panels. Everything works perfectly in HISE, but compiled plug-ins crash.
      When I debug, I get a breakpoint at:

      AsyncUpdater::~AsyncUpdater()
      {
          // You're deleting this object with a background thread while there's an update
          // pending on the main event thread - that's pretty dodgy threading, as the callback could
          // happen after this destructor has finished. You should either use a MessageManagerLock while
          // deleting this object, or find some other way to avoid such a race condition.
          jassert ((! isUpdatePending())
                    || MessageManager::getInstanceWithoutCreating() == nullptr
                    || MessageManager::getInstanceWithoutCreating()->currentThreadHasLockedMessageManager());
      
          activeMessage->shouldDeliver.set (0);
      }
      

      It is triggered by the ScriptPanel:

      ScriptingApi::Content::ScriptPanel::~ScriptPanel()
      {
      	if (parentPanel != nullptr)
      		parentPanel->sendSubComponentChangeMessage(this, false, sendNotificationAsync);
      
      	stopTimer();
      
      	timerRoutine.clear();
      	mouseRoutine.clear();
      	loadRoutine.clear();
      	paintRoutine = var();
          
          loadedImages.clear();
          
          graphics = nullptr;
      }
      
      ScriptingApi::Content::ScriptComponent::~ScriptComponent()
      {
      	if (linkedComponent != nullptr)
      		linkedComponent->removeLinkedTarget(this);
      
      	if (currentAutomationData != nullptr)
      		currentAutomationData->asyncListeners.removeListener(*this);
      }
      

      Commenting out the creation of these additional child panels will make things better.... but minimal examples for adding child panels to other child panels works as expected.
      I'm not sure where to look next.

      Dan Korneff - Producer / Mixer / Audio Nerd

      d.healeyD 1 Reply Last reply Reply Quote 0
      • Dan KorneffD
        Dan Korneff
        last edited by

        You should either use a MessageManagerLock while deleting this object, or find some other way to avoid such a race condition.
        

        After looking again, I noticed that the error occurs when something is deleted.
        The first line of my factory script has:

        	    for (child in myAwesomePanel.getChildPanelList()) {
        	        child.removeFromParent();
        	    }
        

        I'm using this to remove any existing panels from my main panel before I repopulate.
        Commenting this out also solves the issue... but not ideal.

        Adding a conditional statement to only remove child panels if they exist appears to work well.

        if(myAwesomePanel.getChildPanelList().length > 0) {
        	    for (child in myAwesomePanel.getChildPanelList()) {
            	        child.removeFromParent();   
                    }
        }
        

        Are there any adverse affect to doing this?

        Dan Korneff - Producer / Mixer / Audio Nerd

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

          I take it back... still crashing.

          Dan Korneff - Producer / Mixer / Audio Nerd

          1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @Dan Korneff
            last edited by

            @Dan-Korneff said in AsyncUpdater crash when adding childpanel:

            but minimal examples for adding child panels to other child panels works as expected.
            I'm not sure where to look next.

            Brute force approach. Make a duplicate of your project. In that project start deleting stuff (or commenting it out) bit by bit until the crash no longer occurs. That should help you narrow down exactly which bit of your project is causing the crash.

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            Dan KorneffD 1 Reply Last reply Reply Quote 0
            • Dan KorneffD
              Dan Korneff @d.healey
              last edited by

              @d-healey I've been doing that all day :(
              It seems to be triggered by a few different things, so I guess I'm just waiting find that magical combination.
              This app downloads images and draws them into panels, along with other items. It seems that the crash happens when those images are being downloaded.
              Back to investigating.

              Dan Korneff - Producer / Mixer / Audio Nerd

              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @Dan Korneff
                last edited by

                @Dan-Korneff

                It seems that the crash happens when those images are being downloaded.

                Remove the downloading stuff and hardcode the image paths and see if it still happens.

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                Dan KorneffD 1 Reply Last reply Reply Quote 0
                • Dan KorneffD
                  Dan Korneff @d.healey
                  last edited by Dan Korneff

                  @d-healey If the images exits, NO crash

                  Dan Korneff - Producer / Mixer / Audio Nerd

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

                    @Christoph-Hart when I open the project in Visual Studio, I get a bunch of errors off the bat.

                    Severity	Code	Description	Project	File	Line	Suppression State
                    Error (active)	E0020	identifier "activeMessage" is undefined	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	90	
                    Error (active)	E0276	name followed by '::' must be a class or namespace name	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	26	
                    Error (active)	E0262	not a class or struct name	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	26	
                    Error (active)	E0260	explicit type is missing ('int' assumed)	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	29	
                    Error (active)	E0020	identifier "AsyncUpdater" is undefined	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	29	
                    Error (active)	E0065	expected a ';'	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	29	
                    Error (active)	E0864	Atomic is not a template	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	38	
                    Error (active)	E0260	explicit type is missing ('int' assumed)	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	40	
                    Error (active)	E0757	function "juce::<error>::AsyncUpdaterMessage" is not a type name	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	40	
                    Error (active)	E0065	expected a ';'	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	41	
                    Error (active)	E0276	name followed by '::' must be a class or namespace name	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	44	
                    Error (active)	E0020	identifier "activeMessage" is undefined	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	46	
                    Error (active)	E0079	expected a type specifier	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	46	
                    Error (active)	E0258	'this' may only be used inside a nonstatic member function	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	46	
                    Error (active)	E0276	name followed by '::' must be a class or namespace name	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	49	
                    Error (active)	E0020	identifier "jassert" is undefined	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	55	
                    Error (active)	E0020	identifier "isUpdatePending" is undefined	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	55	
                    Error (active)	E0276	name followed by '::' must be a class or namespace name	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	56	
                    Error (active)	E0276	name followed by '::' must be a class or namespace name	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	57	
                    Error (active)	E0020	identifier "activeMessage" is undefined	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	59	
                    Error (active)	E0276	name followed by '::' must be a class or namespace name	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	62	
                    Error (active)	E0020	identifier "JUCE_ASSERT_MESSAGE_MANAGER_EXISTS" is undefined	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	66	
                    Error (active)	E0065	expected a ';'	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	68	
                    Error (active)	E0276	name followed by '::' must be a class or namespace name	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	74	
                    Error (active)	E0020	identifier "activeMessage" is undefined	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	76	
                    Error (active)	E0276	name followed by '::' must be a class or namespace name	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	79	
                    Error (active)	E0020	identifier "JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED" is undefined	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	82	
                    Error (active)	E0065	expected a ';'	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	84	
                    Error (active)	E0276	name followed by '::' must be a class or namespace name	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	88	
                    Error (active)	E1670	a type qualifier is not allowed on a nonmember function	My Test Plugin_SharedCode	C:\Users\Dan\Documents\GitHub\HISE\JUCE\modules\juce_events\broadcasters\juce_AsyncUpdater.cpp	88	
                    

                    Am I doing something silly? or is this something else.

                    Dan Korneff - Producer / Mixer / Audio Nerd

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

                    28

                    Online

                    1.8k

                    Users

                    12.0k

                    Topics

                    104.5k

                    Posts