Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorDamien Plisson <damien.plisson@yahoo.fr>2009-11-17 11:27:11 +0300
committerDamien Plisson <damien.plisson@yahoo.fr>2009-11-17 11:27:11 +0300
commit45e38635a4d84578b87a51c0f1282f28f97413a5 (patch)
treebf3000f3e0c2e6a855ea3d428d70a2cc06d58753 /intern
parent7636d17af627dd10bc7b9c9f66e185af8f8be1ec (diff)
Drag'n'drop : add freeing of dropped resources upon event object release
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_EventDragnDrop.h35
1 files changed, 33 insertions, 2 deletions
diff --git a/intern/ghost/intern/GHOST_EventDragnDrop.h b/intern/ghost/intern/GHOST_EventDragnDrop.h
index f1810b0eb0a..85c18efb118 100644
--- a/intern/ghost/intern/GHOST_EventDragnDrop.h
+++ b/intern/ghost/intern/GHOST_EventDragnDrop.h
@@ -50,8 +50,7 @@
* <li> Outside of the normal sequence, dropped data can be sent (GHOST_kEventDraggingDropOnIcon). This can happen when the user drops an object
* on the application icon. (Also used in OSX to pass the filename of the document the user doubled-clicked in the finder)
*
- * <br><br>Note that the event handler is responsible for freeing the received data.
- * <br>And the mouse positions are given in Blender coordinates (y=0 at bottom)
+ * <br><br>Note that the mouse positions are given in Blender coordinates (y=0 at bottom)
*
* <br>Currently supported object types :
* <li>UTF-8 string
@@ -81,6 +80,38 @@ public:
m_dragnDropEventData.data = data;
m_data = &m_dragnDropEventData;
}
+
+ ~GHOST_EventDragnDrop()
+ {
+ //Free the dropped object data
+ if (m_dragnDropEventData.data == NULL)
+ return;
+
+ switch (m_dragnDropEventData.dataType) {
+ case GHOST_kDragnDropTypeBitmap:
+ //Not currently implemented
+ break;
+ case GHOST_kDragnDropTypeFilenames:
+ {
+ GHOST_TStringArray *strArray = (GHOST_TStringArray*)m_dragnDropEventData.data;
+ int i;
+
+ for (i=0;i<strArray->count;i++)
+ free(strArray->strings[i]);
+
+ free(strArray);
+ }
+ break;
+ case GHOST_kDragnDropTypeString:
+ free(m_dragnDropEventData.data);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+
protected:
/** The x,y-coordinates of the cursor position. */