mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-12 23:38:59 +08:00
Assign on_instances_moved and put a try/catch to not crash if it accidentally gets called while uninitialzed.
This commit is contained in:
parent
5dc9fa1751
commit
427c7c7027
@ -60,6 +60,8 @@ Plater::Plater(wxWindow* parent, const wxString& title, std::shared_ptr<Settings
|
||||
canvas2D->on_select_object = std::function<void (ObjIdx obj_idx)>(on_select_object);
|
||||
canvas2D->on_double_click = std::function<void ()>(on_double_click);
|
||||
canvas2D->on_right_click = std::function<void (const wxPoint& pos)>([=](const wxPoint& pos){ on_right_click(canvas2D, pos); });
|
||||
canvas2D->on_instances_moved = std::function<void ()>(on_instances_moved);
|
||||
|
||||
|
||||
canvas3D = new Plate3D(preview_notebook, wxDefaultSize, objects, model, config, settings);
|
||||
preview_notebook->AddPage(canvas3D, _("3D"));
|
||||
|
@ -212,7 +212,11 @@ void Plate2D::mouse_down(wxMouseEvent& e) {
|
||||
|
||||
void Plate2D::mouse_up(wxMouseEvent& e) {
|
||||
if (e.LeftUp()) {
|
||||
//if (this->drag_object.obj != -1 && this->drag_object.inst != -1) this->on_instances_moved();
|
||||
try {
|
||||
if (this->drag_object.obj != -1 && this->drag_object.inst != -1) this->on_instances_moved();
|
||||
} catch (std::bad_function_call &ex) {
|
||||
Slic3r::Log::error(LogChannel, L"On_instances_moved was not intialized to a function.");
|
||||
}
|
||||
this->drag_start_pos = wxPoint(-1, -1);
|
||||
this->drag_object = {-1, -1};
|
||||
this->SetCursor(*wxSTANDARD_CURSOR);
|
||||
|
Loading…
x
Reference in New Issue
Block a user