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.
This commit is contained in:
Lawrence Lee 2021-03-07 11:58:36 -08:00
parent 10b5f65b30
commit f958074d9b

View File

@ -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;
}