Fixed crash when dismissing file dialog for quick slice menu command

This commit is contained in:
Enrico Turri 2018-11-15 12:21:09 +01:00
parent ed271d66e6
commit e83e755e8b
2 changed files with 14 additions and 13 deletions

View file

@ -233,25 +233,25 @@ void MainFrame::init_menubar()
append_menu_item(fileMenu, wxID_ANY, _(L("&Export Config Bundle…")), _(L("Export all presets to file")),
[this](wxCommandEvent&) { export_configbundle(); }, "lorry_go.png");
fileMenu->AppendSeparator();
wxMenuItem* repeat = nullptr;
append_menu_item(fileMenu, wxID_ANY, _(L("Q&uick Slice…\tCtrl+U")), _(L("Slice a file into a G-code")),
[this, repeat](wxCommandEvent&) {
wxTheApp->CallAfter([this, repeat]() {
m_menu_item_repeat = nullptr;
append_menu_item(fileMenu, wxID_ANY, _(L("Q&uick Slice…\tCtrl+U")), _(L("Slice a file into a G-code")),
[this](wxCommandEvent&) {
wxTheApp->CallAfter([this]() {
quick_slice();
repeat->Enable(is_last_input_file());
}); }, "cog_go.png");
append_menu_item(fileMenu, wxID_ANY, _(L("Quick Slice and Save &As…\tCtrl+Alt+U")), _(L("Slice a file into a G-code, save as")),
[this, repeat](wxCommandEvent&) {
wxTheApp->CallAfter([this, repeat]() {
m_menu_item_repeat->Enable(is_last_input_file());
}); }, "cog_go.png");
append_menu_item(fileMenu, wxID_ANY, _(L("Quick Slice and Save &As…\tCtrl+Alt+U")), _(L("Slice a file into a G-code, save as")),
[this](wxCommandEvent&) {
wxTheApp->CallAfter([this]() {
quick_slice(qsSaveAs);
repeat->Enable(is_last_input_file());
}); }, "cog_go.png");
repeat = append_menu_item(fileMenu, wxID_ANY, _(L("&Repeat Last Quick Slice\tCtrl+Shift+U")), _(L("Repeat last quick slice")),
m_menu_item_repeat->Enable(is_last_input_file());
}); }, "cog_go.png");
m_menu_item_repeat = append_menu_item(fileMenu, wxID_ANY, _(L("&Repeat Last Quick Slice\tCtrl+Shift+U")), _(L("Repeat last quick slice")),
[this](wxCommandEvent&) {
wxTheApp->CallAfter([this]() {
quick_slice(qsReslice);
}); }, "cog_go.png");
repeat->Enable(0);
m_menu_item_repeat->Enable(false);
fileMenu->AppendSeparator();
append_menu_item(fileMenu, wxID_ANY, _(L("Slice to SV&G…\tCtrl+G")), _(L("Slice file to a multi-layer SVG")),
[this](wxCommandEvent&) { quick_slice(qsSaveAs | qsExportSVG); }, "shape_handles.png");

View file

@ -55,6 +55,7 @@ class MainFrame : public wxFrame
std::map<std::string, Tab*> m_options_tabs;
wxMenuItem* m_menu_item_repeat { nullptr };
wxMenuItem* m_menu_item_reslice_now { nullptr };
wxMenu* m_plater_menu { nullptr };
wxMenu* m_viewMenu{ nullptr };