Skip to content
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

DeferredAction destructor causes assert #578

Open
davispolito opened this issue Feb 8, 2025 · 0 comments
Open

DeferredAction destructor causes assert #578

davispolito opened this issue Feb 8, 2025 · 0 comments

Comments

@davispolito
Copy link

davispolito commented Feb 8, 2025

Timer::~Timer()
{
    // If you're destroying a timer on a background thread, make sure the timer has
    // been stopped before execution reaches this point. A simple way to achieve this
    // is to add a call to `stopTimer()` to the destructor of your class which inherits
    // from Timer.
    jassert (! isTimerRunning()
             || MessageManager::getInstanceWithoutCreating() == nullptr
             || MessageManager::getInstanceWithoutCreating()->currentThreadHasLockedMessageManager());

    stopTimer();
}

Broke at this assert.

a pluginstate is created on the message thread and then I use a separate function queue to add that into my AudioProcessorGraph on the audio thread.

auto proc = parent->getSynth()->modulator_factory.create(v.getProperty(IDs::type).toString().toStdString(),args);
        auto *module_section = new ModulationSection(v, (proc->createEditor()));
        container_->addSubSection(module_section);
        module_section->setInterceptsMouseClicks(false,true);
        parentHierarchyChanged();
        parent->tryEnqueueProcessorInitQueue(
            [this, proc] {
                SynthGuiInterface* _parent = findParentComponentOfClass<SynthGuiInterface>();
//                _parent->addProcessor(proc, 0);
            });

I noticed this "bug" as I was implementing the code above. You'll notice that the proc goes into that function and nothing happens so it will then get destroyed on the audiothread which is where I assume the assert is complaining about MessageManager::getInstanceWithoutCreating()->currentThreadHasLockedMessageManager() so seems like a user error to me maybe but just wanted to log it just in case

@davispolito davispolito changed the title deferredactionn destructor causes crash eferredAction destructor causes crash Feb 8, 2025
@davispolito davispolito changed the title eferredAction destructor causes crash DeferredAction destructor causes crash Feb 8, 2025
@davispolito davispolito changed the title DeferredAction destructor causes crash DeferredAction destructor causes assert Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant