Fixed a crash caused by double-free on application close event (Linux)

This commit is contained in:
Lukas Matena 2019-01-28 12:12:14 +01:00
parent 61d59a7a2e
commit ddcb2b1c23
3 changed files with 8 additions and 26 deletions

View file

@ -270,16 +270,11 @@ void GUI_App::set_label_clr_sys(const wxColour& clr) {
void GUI_App::recreate_GUI()
{
std::cerr << "recreate_GUI" << std::endl;
// to make sure nobody accesses data from the soon-to-be-destroyed widgets:
tabs_list.clear();
plater_ = nullptr;
clear_tabs_list();
if (plater_) {
// before creating a new plater let's delete old one
plater_->Destroy();
plater_ = nullptr;
}
MainFrame* topwindow = dynamic_cast<MainFrame*>(GetTopWindow());
MainFrame* topwindow = mainframe;
mainframe = new MainFrame();
sidebar().obj_list()->init_objects(); // propagate model objects to object list
@ -691,15 +686,6 @@ void GUI_App::load_current_presets()
}
}
void GUI_App::clear_tabs_list()
{
for (auto tab : tabs_list) {
tab->Destroy();
tab = nullptr;
}
tabs_list.clear();
}
#ifdef __APPLE__
// wxWidgets override to get an event on open files.
void GUI_App::MacOpenFiles(const wxArrayString &fileNames)