Print Page | Close Window

Dragging CXTPTaskPanelGroupItem leaks or crashes.

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Task Panel
Forum Description: Topics Related to Codejock Task Panel
URL: http://forum.codejock.com/forum_posts.asp?TID=22577
Printed Date: 26 April 2024 at 7:21am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Dragging CXTPTaskPanelGroupItem leaks or crashes.
Posted By: Mazeppa
Subject: Dragging CXTPTaskPanelGroupItem leaks or crashes.
Date Posted: 17 April 2015 at 12:40pm
I'm using the Task Panel from ToolKitPro in my MFC app. I allow users to drag items out of the TaskPanel and drop them into an open document. I noticed that a TaskPanelGroupItem was leaking twice every time someone dropped one into a document.

The leaks are occurring in my DragOver and Drop methods. In each method, I have code like this:

CXTPTaskPanelGroupItem* pItemDrop = (CXTPTaskPanelGroupItem*)CXTPTaskPanelItem::CreateFromOleData(pDataObject);
if (pItemDrop)
{
...
}

So I added a delete pItemDrop before the end brace in both cases. This works great in a Debug build and stops the leaks. But in a Release build, it crashes hard the instant I call delete.

What should I do to keep it from leaking or crashing?


-------------
Mark Woodard



Replies:
Posted By: Mazeppa
Date Posted: 17 April 2015 at 12:59pm
I may have answered my own question. Instead of deleting pItemDrop, I called pItemDrop->ExternalRelease(). That seems to stop the leaks in a Debug build, and it doesn't crash in a Release build. Someone let me know if I should be calling InternalRelease() instead.

-------------
Mark Woodard



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net