sudara / melatonin_inspector

A JUCE module that gives you the ability to inspect and visually edit (non-destructively) components in your UI.
MIT License
145 stars 17 forks source link

Access violation in optimized builds. #40

Closed FigBug closed 1 year ago

FigBug commented 1 year ago

On Windows I'm seeing access violation in optimized builds. Works fine in Debug. Just wondering if you'd seen this? Having trouble figuring out the cause. Crash as the window opens.

>   [Inline Frame] Nexus.exe!juce::CharPointer_UTF8::getAndAdvance() Line 149   C++
    Nexus.exe!juce::CharacterFunctions::compare<juce::CharPointer_UTF8,juce::CharPointer_UTF8>(juce::CharPointer_UTF8 s1, juce::CharPointer_UTF8 s2) Line 612   C++
    [Inline Frame] Nexus.exe!juce::CharPointer_UTF8::compare(const juce::CharPointer_UTF8 other) Line 401   C++
    [Inline Frame] Nexus.exe!juce::String::compare(const juce::String & other) Line 596 C++
    Nexus.exe!juce::operator!=(const juce::String & s1, const juce::String & s2) Line 555   C++
    [Inline Frame] Nexus.exe!juce::Button::setButtonText(const juce::String & newText) Line 98  C++
    Nexus.exe!juce::BooleanPropertyComponent::refresh() Line 83 C++
    Nexus.exe!juce::PropertyPanel::SectionComponent::SectionComponent(const juce::String & sectionTitle, const juce::Array<juce::PropertyComponent *,juce::DummyCriticalSection,0> & newProperties, bool sectionIsOpen, int extraPadding) Line 43   C++
    Nexus.exe!juce::PropertyPanel::addProperties(const juce::Array<juce::PropertyComponent *,juce::DummyCriticalSection,0> & newProperties, int extraPaddingBetweenComponents) Line 259 C++
    Nexus.exe!melatonin::Properties::updateProperties() Line 58 C++
    [Inline Frame] Nexus.exe!melatonin::ComponentModel::removeListeners::<lambda_1>::operator()(melatonin::ComponentModel::Listener & listener) Line 123    C++
    [Inline Frame] Nexus.exe!juce::ListenerList<melatonin::ComponentModel::Listener,juce::Array<melatonin::ComponentModel::Listener *,juce::DummyCriticalSection,0>>::call(melatonin::ComponentModel::removeListeners::<lambda_1> && callback) Line 140 C++
    Nexus.exe!melatonin::ComponentModel::removeListeners() Line 122 C++
    Nexus.exe!melatonin::ComponentModel::updateModel() Line 81  C++
    Nexus.exe!melatonin::InspectorComponent::selectComponent(juce::Component * component, bool collapseTreeBeforeSelection) Line 245    C++
    Nexus.exe!melatonin::InspectorComponent::toggle(bool enabled) Line 284  C++
    [External Code] 
    [Inline Frame] Nexus.exe!juce::InternalMessageQueue::dispatchMessage(juce::MessageManager::MessageBase * message) Line 192  C++
    Nexus.exe!juce::InternalMessageQueue::dispatchMessages() Line 234   C++
    Nexus.exe!juce::InternalMessageQueue::dispatchNextMessage(bool returnIfNoPendingMessages) Line 144  C++
    [Inline Frame] Nexus.exe!juce::detail::dispatchNextMessageOnSystemQueue(bool returnIfNoPendingMessages) Line 263    C++
    [Inline Frame] Nexus.exe!juce::MessageManager::runDispatchLoop() Line 112   C++
    Nexus.exe!juce::JUCEApplicationBase::main() Line 265    C++
    [External Code] 
sudara commented 1 year ago

This looks new to me, but I haven't been on windows the last few commits and I conditionally exclude the inspector in release builds in my main proj.

I'll check it out tomorrow!

sudara commented 1 year ago

ah just remembered windows once had problems with the unicode × (multiplication character) used in the ui to show dimensions (it lines up nicer than a normal x)… maybe theres another problem with something like that…

FigBug commented 1 year ago

The BooleanPropertyComponent constructor takes a Value&, if that Value doesn't continue to exist, I get crashes. Once I replace the temporary objects with a member variable, crashes go away. I will open a pull another request soon.

sudara commented 1 year ago

Closed by #42