Mon, 05 May 2014 16:50:36 +0300
- when an object is deleted, if it's the renderer's object-under-cursor the field needs to be cleared or ldforge crashes
src/glRenderer.h | file | annotate | diff | comparison | revisions | |
src/ldObject.cc | file | annotate | diff | comparison | revisions |
--- a/src/glRenderer.h Mon May 05 02:19:35 2014 +0300 +++ b/src/glRenderer.h Mon May 05 16:50:36 2014 +0300 @@ -146,7 +146,7 @@ PROPERTY (public, LDDocument*, document, setDocument, CUSTOM_WRITE) PROPERTY (public, EditMode, editMode, setEditMode, CUSTOM_WRITE) PROPERTY (private, GLCompiler*, compiler, setCompiler, STOCK_WRITE) - PROPERTY (private, LDObject*, objectAtCursor, setObjectAtCursor, STOCK_WRITE) + PROPERTY (public, LDObject*, objectAtCursor, setObjectAtCursor, STOCK_WRITE) PROPERTY (private, bool, isCameraMoving, setCameraMoving, STOCK_WRITE) public:
--- a/src/ldObject.cc Mon May 05 02:19:35 2014 +0300 +++ b/src/ldObject.cc Mon May 05 16:50:36 2014 +0300 @@ -276,6 +276,11 @@ // Remove this object from the list of LDObjects g_LDObjects.removeOne (this); + // The renderer's mouse-over field also needs to be cleared... + // Remind me to implement smart pointers someday. + if (g_win->R()->objectAtCursor() == this) + g_win->R()->setObjectAtCursor (null); + delete this; }