mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Attempt to fix crash on MAC when closing using Command+Q
This commit is contained in:
		
							parent
							
								
									1bff1f7460
								
							
						
					
					
						commit
						dcf3565426
					
				
					 4 changed files with 47 additions and 2 deletions
				
			
		|  | @ -51,7 +51,9 @@ View3D::~View3D() | ||||||
| #if ENABLE_NON_STATIC_CANVAS_MANAGER | #if ENABLE_NON_STATIC_CANVAS_MANAGER | ||||||
|     if (m_canvas != nullptr) |     if (m_canvas != nullptr) | ||||||
|     { |     { | ||||||
|         m_canvas->unbind_event_handlers(); | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
|  | //        m_canvas->unbind_event_handlers();
 | ||||||
|  | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
|         delete m_canvas; |         delete m_canvas; | ||||||
|     } |     } | ||||||
| #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
 | #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
 | ||||||
|  | @ -379,7 +381,9 @@ Preview::~Preview() | ||||||
| #if ENABLE_NON_STATIC_CANVAS_MANAGER | #if ENABLE_NON_STATIC_CANVAS_MANAGER | ||||||
|     if (m_canvas != nullptr) |     if (m_canvas != nullptr) | ||||||
|     { |     { | ||||||
|         m_canvas->unbind_event_handlers(); | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
|  | //        m_canvas->unbind_event_handlers();
 | ||||||
|  | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
|         delete m_canvas; |         delete m_canvas; | ||||||
|     } |     } | ||||||
| #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
 | #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
 | ||||||
|  |  | ||||||
|  | @ -115,6 +115,15 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S | ||||||
| 
 | 
 | ||||||
|         if(m_plater) m_plater->stop_jobs(); |         if(m_plater) m_plater->stop_jobs(); | ||||||
| 
 | 
 | ||||||
|  | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
|  | #if ENABLE_NON_STATIC_CANVAS_MANAGER | ||||||
|  |         // Unbinding of wxWidgets event handling in canvases needs to be done here because on MAC,
 | ||||||
|  |         // when closing the application using Command+Q, a mouse event is triggered after this lambda is completed,
 | ||||||
|  |         // causing a crash
 | ||||||
|  |         if (m_plater) m_plater->unbind_canvas_event_handlers(); | ||||||
|  | #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
 | ||||||
|  | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
|  | 
 | ||||||
|         // Weird things happen as the Paint messages are floating around the windows being destructed.
 |         // Weird things happen as the Paint messages are floating around the windows being destructed.
 | ||||||
|         // Avoid the Paint messages by hiding the main window.
 |         // Avoid the Paint messages by hiding the main window.
 | ||||||
|         // Also the application closes much faster without these unnecessary screen refreshes.
 |         // Also the application closes much faster without these unnecessary screen refreshes.
 | ||||||
|  |  | ||||||
|  | @ -1814,6 +1814,11 @@ struct Plater::priv | ||||||
| 
 | 
 | ||||||
|     void set_current_canvas_as_dirty(); |     void set_current_canvas_as_dirty(); | ||||||
|     GLCanvas3D* get_current_canvas3D(); |     GLCanvas3D* get_current_canvas3D(); | ||||||
|  | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
|  | #if ENABLE_NON_STATIC_CANVAS_MANAGER | ||||||
|  |     void unbind_canvas_event_handlers(); | ||||||
|  | #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
 | ||||||
|  | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
| 
 | 
 | ||||||
|     bool init_view_toolbar(); |     bool init_view_toolbar(); | ||||||
| 
 | 
 | ||||||
|  | @ -4089,6 +4094,19 @@ GLCanvas3D* Plater::priv::get_current_canvas3D() | ||||||
|     return (current_panel == view3D) ? view3D->get_canvas3d() : ((current_panel == preview) ? preview->get_canvas3d() : nullptr); |     return (current_panel == view3D) ? view3D->get_canvas3d() : ((current_panel == preview) ? preview->get_canvas3d() : nullptr); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
|  | #if ENABLE_NON_STATIC_CANVAS_MANAGER | ||||||
|  | void Plater::priv::unbind_canvas_event_handlers() | ||||||
|  | { | ||||||
|  |     if (view3D != nullptr) | ||||||
|  |         view3D->get_canvas3d()->unbind_event_handlers(); | ||||||
|  | 
 | ||||||
|  |     if (preview != nullptr) | ||||||
|  |         preview->get_canvas3d()->unbind_event_handlers(); | ||||||
|  | } | ||||||
|  | #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
 | ||||||
|  | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
|  | 
 | ||||||
| bool Plater::priv::init_view_toolbar() | bool Plater::priv::init_view_toolbar() | ||||||
| { | { | ||||||
|     if (view_toolbar.get_items_count() > 0) |     if (view_toolbar.get_items_count() > 0) | ||||||
|  | @ -5527,6 +5545,15 @@ void Plater::set_current_canvas_as_dirty() | ||||||
|     p->set_current_canvas_as_dirty(); |     p->set_current_canvas_as_dirty(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
|  | #if ENABLE_NON_STATIC_CANVAS_MANAGER | ||||||
|  | void Plater::unbind_canvas_event_handlers() | ||||||
|  | { | ||||||
|  |     p->unbind_canvas_event_handlers(); | ||||||
|  | } | ||||||
|  | #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
 | ||||||
|  | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
|  | 
 | ||||||
| PrinterTechnology Plater::printer_technology() const | PrinterTechnology Plater::printer_technology() const | ||||||
| { | { | ||||||
|     return p->printer_technology; |     return p->printer_technology; | ||||||
|  |  | ||||||
|  | @ -253,6 +253,11 @@ public: | ||||||
|     BoundingBoxf bed_shape_bb() const; |     BoundingBoxf bed_shape_bb() const; | ||||||
| 
 | 
 | ||||||
|     void set_current_canvas_as_dirty(); |     void set_current_canvas_as_dirty(); | ||||||
|  | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
|  | #if ENABLE_NON_STATIC_CANVAS_MANAGER | ||||||
|  |     void unbind_canvas_event_handlers(); | ||||||
|  | #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
 | ||||||
|  | //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | ||||||
| 
 | 
 | ||||||
|     PrinterTechnology   printer_technology() const; |     PrinterTechnology   printer_technology() const; | ||||||
|     void                set_printer_technology(PrinterTechnology printer_technology); |     void                set_printer_technology(PrinterTechnology printer_technology); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Enrico Turri
						Enrico Turri