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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-09-03 21:41:47 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-09-03 21:41:47 +0400
commit195c520d0567782dbe09d6fc1506d630a11372da (patch)
tree151d621cf645c754c128c774d185b4a36803986f /intern/ghost
parent989313e4500bd953c1558247a454a070515f4c6c (diff)
Fix #32046: GHOST_DropTargetWin32 memory leak, patch by Matt D.
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/intern/GHOST_DropTargetWin32.cpp4
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp12
2 files changed, 11 insertions, 5 deletions
diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
index 4142b19f21d..89e9a91b34c 100644
--- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
@@ -51,14 +51,10 @@ GHOST_DropTargetWin32::GHOST_DropTargetWin32(GHOST_WindowWin32 *window, GHOST_Sy
m_cRef = 1;
m_hWnd = window->getHWND();
m_draggedObjectType = GHOST_kDragnDropTypeUnknown;
-
- // register our window as drop target
- ::RegisterDragDrop(m_hWnd, this);
}
GHOST_DropTargetWin32::~GHOST_DropTargetWin32()
{
- ::RevokeDragDrop(m_hWnd);
}
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 3a6e646de11..71a9db349ee 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -271,6 +271,10 @@ GHOST_WindowWin32::GHOST_WindowWin32(
// Register this window as a droptarget. Requires m_hWnd to be valid.
// Note that OleInitialize(0) has to be called prior to this. Done in GHOST_SystemWin32.
m_dropTarget = new GHOST_DropTargetWin32(this, m_system);
+ if (m_dropTarget) {
+ ::RegisterDragDrop(m_hWnd, m_dropTarget);
+ }
+
// Store a pointer to this class in the window structure
::SetWindowLongPtr(m_hWnd, GWL_USERDATA, (LONG_PTR) this);
@@ -415,7 +419,13 @@ GHOST_WindowWin32::~GHOST_WindowWin32()
m_hDC = 0;
}
if (m_hWnd) {
- m_dropTarget->Release(); // frees itself.
+ if (m_dropTarget) {
+ // Disable DragDrop
+ RevokeDragDrop(m_hWnd);
+ // Release our reference of the DropTarget and it will delete itself eventually.
+ m_dropTarget->Release();
+ }
+
::DestroyWindow(m_hWnd);
m_hWnd = 0;
}