CXTPImageManagerIconHandle bug! |
Post Reply |
Author | |
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Posted: 02 September 2008 at 4:14am |
CXTPImageManagerIconHandle foo()
{
CXTPImageManagerIconHandle hIcon; hIcon = ...
return hIcon; // Destructor called for hIcon
}
hIcon.m_bClearHandles == TRUE... so the returned object will be corrupted. I believe you should use auto_ptr-thinking here!
In copy-constructor and assignment-operator the right-hand-side variable m_bClearHandles should be set to FALSE!
h1 = h2; // h2.m_bClearHandles = FALSE
My solution:
mutable BOOL m_bClearHandles;
CXTPImageManagerIconHandle::CXTPImageManagerIconHandle(const CXTPImageManagerIconHandle& hHandle)
{
...
hHandle.m_bClearHandles = FALSE;
}
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Its'wrong. Don't change it.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
I disagree. The class is broken since it cannot be returned without destroying the icon.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
you can change it but you will get a lot of resource leaks.
better change your method to get reference
bool foo(CXTPImageManagerIconHandle& out)
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |