1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Avoided DragAndDropContainer holding onto its description object after a drag finishes.

This commit is contained in:
jules 2013-11-19 21:22:21 +00:00
parent afb5904e89
commit 8efe5abb1a
2 changed files with 11 additions and 13 deletions

View file

@ -34,14 +34,13 @@ public:
DragImageComponent (const Image& im,
const var& desc,
Component* const sourceComponent,
Component* const mouseDragSource_,
DragAndDropContainer& owner_,
Point<int> imageOffset_)
Component* const mouseSource,
DragAndDropContainer& ddc,
Point<int> offset)
: sourceDetails (desc, sourceComponent, Point<int>()),
image (im),
owner (owner_),
mouseDragSource (mouseDragSource_),
imageOffset (imageOffset_),
image (im), owner (ddc),
mouseDragSource (mouseSource),
imageOffset (offset),
hasCheckedForExternalDrag (false)
{
setSize (im.getWidth(), im.getHeight());
@ -189,8 +188,9 @@ public:
return targetComponent == mouseDragSource;
}
private:
DragAndDropTarget::SourceDetails sourceDetails;
private:
Image image;
DragAndDropContainer& owner;
WeakReference<Component> mouseDragSource, currentlyOverComp;
@ -391,8 +391,6 @@ void DragAndDropContainer::startDragging (const var& sourceDescription,
dragImageComponent = new DragImageComponent (dragImage, sourceDescription, sourceComponent,
draggingSource->getComponentUnderMouse(), *this, imageOffset);
currentDragDesc = sourceDescription;
if (allowDraggingToExternalWindows)
{
if (! Desktop::canUseSemiTransparentWindows())
@ -435,7 +433,7 @@ bool DragAndDropContainer::isDragAndDropActive() const
var DragAndDropContainer::getCurrentDragDescription() const
{
return dragImageComponent != nullptr ? currentDragDesc
return dragImageComponent != nullptr ? dragImageComponent->sourceDetails.description
: var();
}