summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dragdrop.h8
-rw-r--r--src/item.cpp1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/dragdrop.h b/src/dragdrop.h
index 5630f9248..a2c94facf 100644
--- a/src/dragdrop.h
+++ b/src/dragdrop.h
@@ -80,6 +80,14 @@ class DragDrop
Item *getSelected()
{ return mSelItem; }
+ void clearItem(const Item *const item)
+ {
+ if (mItem == item)
+ clear();
+ if (mSelItem == item)
+ mSelItem = nullptr;
+ }
+
private:
Item *mItem;
Item *mSelItem;
diff --git a/src/item.cpp b/src/item.cpp
index 90ca9ea35..f686f5cf6 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -68,6 +68,7 @@ Item::~Item()
mDrawImage->decRef();
mDrawImage = nullptr;
}
+ dragDrop.clearItem(this);
}
void Item::setId(const int id, const unsigned char color)