Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Task Panel
  New Posts New Posts RSS Feed - Dragging CXTPTaskPanelGroupItem leaks or crashes.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Dragging CXTPTaskPanelGroupItem leaks or crashes.

 Post Reply Post Reply
Author
Message
Mazeppa View Drop Down
Newbie
Newbie
Avatar

Joined: 31 July 2013
Location: Plano, TX
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mazeppa Quote  Post ReplyReply Direct Link To This Post Topic: Dragging CXTPTaskPanelGroupItem leaks or crashes.
    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
Back to Top
Mazeppa View Drop Down
Newbie
Newbie
Avatar

Joined: 31 July 2013
Location: Plano, TX
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mazeppa Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.