From f958074d9bd5ece66aeb79a79424c978995940e0 Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Sun, 7 Mar 2021 11:58:36 -0800 Subject: [PATCH] Fix crash when deleting spot removal spot Deleting a spot while hovering over one of the circles for adjusting the radius or feathering could trigger a crash. This is because immediately after deleting a geometry object, EditSubscriber::getCursor is given an object ID based on old data, causing the spot tool to attempt to get information about the deleted geometry object. This commit fixes the issue by returning the default cursor if the active spot is -1. It works because the active spot is set to -1 when deleting a spot, and there is no need to use a special cursor when there is no active spot. A better long-term solution would be updating the geometry data before calling EditSubscriber::getCursor. --- rtgui/spot.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtgui/spot.cc b/rtgui/spot.cc index 1f3759c6b..6d749838b 100644 --- a/rtgui/spot.cc +++ b/rtgui/spot.cc @@ -462,7 +462,7 @@ void Spot::deleteSelectedEntry() CursorShape Spot::getCursor (int objectID, int xPos, int yPos) const { const EditDataProvider* editProvider = getEditProvider(); - if (editProvider) { + if (editProvider && activeSpot > -1) { if (draggedSide != DraggedSide::NONE) { return CSEmpty; }