Skip to content

Linux VST3 Segmentation Fault in MarkdownDatabaseHolder::shouldAbort() #777

@dustbro

Description

@dustbro

VST3 plugins crash with segmentation fault on Linux during initialization when loading in DAWs like Reaper. The crash occurs in the markdown documentation system during FloatingTile initialization.

Environment

  • OS: Linux (PopOS)
  • Plugin Format: VST3
  • DAW: Reaper (and likely others)
  • HISE Version: Current develop branch

Steps to Reproduce

  1. Compile a VST3 plugin on Linux that contains a markdown floating tile
  2. Load the VST3 plugin in Reaper on Linux
  3. Plugin crashes immediately during initialization

Expected Behavior

The VST3 plugin should load successfully without crashing, as it does on macOS and Windows.

Actual Behavior

The plugin crashes with a segmentation fault during initialization.

Stack Trace

Thread 1 "reaper" received signal SIGSEGV, Segmentation fault.
0x00007fffcba83e24 in juce::Thread::threadShouldExit() const ()

(gdb) bt
#0  0x00007fffcba83e24 in juce::Thread::threadShouldExit() const ()
#1  0x00007fffcb662549 in hise::MarkdownDatabaseHolder::rebuildDatabase() ()
#2  0x00007fffcbd8c949 in hise::MainController::getProjectDocHolder() ()
#3  0x00007fffcb1c5dba in hise::MarkdownPreviewPanel::initPanel() ()
#4  0x00007fffcbed0ff8 in hise::FloatingTile::setContent(juce::var const&) ()
#5  0x00007fffcb1b9ddd in hise::ScriptCreatedComponentWrappers::FloatingTileWrapper::FloatingTileWrapper(...)
...

The crash occurs in MarkdownDatabaseHolder::shouldAbort() method in /hi_tools/hi_markdown/MarkdownDatabase.cpp. The method calls:

Thread::getCurrentThread()->threadShouldExit()

This fix is working for me

Add a null pointer check in the shouldAbort() method before calling threadShouldExit():

File: hi_tools/hi_markdown/MarkdownDatabase.cpp

Before (lines ~762-768):

bool MarkdownDatabaseHolder::shouldAbort() const
{
    if (!MessageManager::getInstance()->isThisTheMessageThread() &&
        Thread::getCurrentThread()->threadShouldExit())
    {
        return true;
    }

    return false;
}

After:

bool MarkdownDatabaseHolder::shouldAbort() const
{
    if (!MessageManager::getInstance()->isThisTheMessageThread())
    {
        // getCurrentThread() may return nullptr during VST3 initialization
        auto* currentThread = Thread::getCurrentThread();
        if (currentThread != nullptr && currentThread->threadShouldExit())
        {
            return true;
        }
    }

    return false;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions