Print Page | Close Window

CXTPImageManagerIconHandle bug!

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=12041
Printed Date: 10 May 2025 at 5:05am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPImageManagerIconHandle bug!
Posted By: znakeeye
Subject: CXTPImageManagerIconHandle bug!
Date 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;
}



Replies:
Posted By: Oleg
Date Posted: 08 September 2008 at 3:27am
Hi,
 
Its'wrong. Don't change it.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: znakeeye
Date Posted: 09 September 2008 at 2:43pm
I disagree. The class is broken since it cannot be returned without destroying the icon.


Posted By: Oleg
Date Posted: 09 September 2008 at 2:56pm
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



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