Defer creation of filebrowsercomponent. Seems to fix the crash in Reaper with release build.
This commit is contained in:
parent
61baf392c7
commit
eef1f1a8e7
@ -36,14 +36,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
|
|||||||
m_filefilter(p.m_afm->getWildcardForAllFormats(),String(),String())
|
m_filefilter(p.m_afm->getWildcardForAllFormats(),String(),String())
|
||||||
{
|
{
|
||||||
|
|
||||||
String initiallocfn = processor.m_propsfile->m_props_file->getValue("importfilefolder",
|
|
||||||
File::getSpecialLocation(File::userHomeDirectory).getFullPathName());
|
|
||||||
File initialloc(initiallocfn);
|
|
||||||
String filterstring = processor.m_afm->getWildcardForAllFormats();
|
|
||||||
|
|
||||||
m_filechooser = std::make_unique<FileBrowserComponent>(1|4,
|
|
||||||
initialloc, &m_filefilter, nullptr);
|
|
||||||
m_filechooser->addListener(this);
|
|
||||||
|
|
||||||
setWantsKeyboardFocus(true);
|
setWantsKeyboardFocus(true);
|
||||||
m_wave_container = new Component;
|
m_wave_container = new Component;
|
||||||
@ -65,6 +58,16 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
|
|||||||
m_import_button.setButtonText("Show browser");
|
m_import_button.setButtonText("Show browser");
|
||||||
m_import_button.onClick = [this]()
|
m_import_button.onClick = [this]()
|
||||||
{
|
{
|
||||||
|
if (m_filechooser == nullptr)
|
||||||
|
{
|
||||||
|
String initiallocfn = processor.m_propsfile->m_props_file->getValue("importfilefolder",
|
||||||
|
File::getSpecialLocation(File::userHomeDirectory).getFullPathName());
|
||||||
|
File initialloc(initiallocfn);
|
||||||
|
m_filechooser = std::make_unique<FileBrowserComponent>(1 | 4,
|
||||||
|
initialloc, &m_filefilter, nullptr);
|
||||||
|
m_filechooser->addListener(this);
|
||||||
|
addChildComponent(m_filechooser.get());
|
||||||
|
}
|
||||||
m_filechooser->setBounds(0, 50, getWidth(), getHeight() - 60);
|
m_filechooser->setBounds(0, 50, getWidth(), getHeight() - 60);
|
||||||
m_filechooser->setVisible(!m_filechooser->isVisible());
|
m_filechooser->setVisible(!m_filechooser->isVisible());
|
||||||
if (m_filechooser->isVisible())
|
if (m_filechooser->isVisible())
|
||||||
@ -256,7 +259,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
|
|||||||
startTimer(2, 1000);
|
startTimer(2, 1000);
|
||||||
startTimer(3, 200);
|
startTimer(3, 200);
|
||||||
m_wavecomponent.startTimer(100);
|
m_wavecomponent.startTimer(100);
|
||||||
addChildComponent(m_filechooser.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PaulstretchpluginAudioProcessorEditor::~PaulstretchpluginAudioProcessorEditor()
|
PaulstretchpluginAudioProcessorEditor::~PaulstretchpluginAudioProcessorEditor()
|
||||||
|
@ -416,6 +416,17 @@ private:
|
|||||||
int64 m_playpos = 0;
|
int64 m_playpos = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MyFileBrowserComponent : public Component
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyFileBrowserComponent()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
std::unique_ptr<FileBrowserComponent> m_fbcomp;
|
||||||
|
};
|
||||||
|
|
||||||
class PaulstretchpluginAudioProcessorEditor : public AudioProcessorEditor,
|
class PaulstretchpluginAudioProcessorEditor : public AudioProcessorEditor,
|
||||||
public MultiTimer, public FileDragAndDropTarget, public DragAndDropContainer, public FileBrowserListener
|
public MultiTimer, public FileDragAndDropTarget, public DragAndDropContainer, public FileBrowserListener
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user