Skip to content

Commit

Permalink
Fix crash when loading Neuropixels default config
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaldoshi committed Jun 10, 2024
1 parent 39e33aa commit eea9990
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Source/UI/DefaultConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void DefaultConfigWindow::launchWindow()
auto* window = options.launchAsync();
window->setAlwaysOnTop (true);
configWindow = window;
((DefaultConfigComponent*) window->getContentComponent())->configWindow = window;
}

//-----------------------------------------------------------------------
Expand Down Expand Up @@ -239,15 +240,15 @@ void DefaultConfigComponent::buttonClicked (Button* button)
#endif

// Hide the config window
if (DialogWindow* dw = this->findParentComponentOfClass<DialogWindow>())
dw->setVisible (false);
if (configWindow != nullptr)
configWindow->setVisible (false);

// Load the config file
AccessClass::getUIComponent()->getEditorViewport()->loadState (configFile);

// Close config window after loading the config file
if (DialogWindow* dw = this->findParentComponentOfClass<DialogWindow>())
dw->exitModalState (0);
if (configWindow != nullptr)
configWindow->exitModalState (0);
}
else if (button->getRadioGroupId() == 101)
{
Expand Down
2 changes: 2 additions & 0 deletions Source/UI/DefaultConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class DefaultConfigComponent : public Component,
/** Responds to button clicks*/
void buttonClicked (Button*) override;

WeakReference<Component> configWindow;

private:
std::unique_ptr<Label> configLabel;
std::unique_ptr<ComboBox> configSelector;
Expand Down

0 comments on commit eea9990

Please sign in to comment.