Print Page | Close Window

Bug in CXTOutBarCtrl::GetItemSize

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=8254
Printed Date: 13 November 2025 at 7:35pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Bug in CXTOutBarCtrl::GetItemSize
Posted By: KirillMueller
Subject: Bug in CXTOutBarCtrl::GetItemSize
Date Posted: 01 October 2007 at 3:53pm
The code at lines 1833-1834 of XTOutBarCtrl.cpp (function CSize CXTOutBarCtrl::GetItemSize(const int iFolder, const int iIndex, const RectItem iType)) reads:

if (iIndex < 0 && iIndex >= pBarFolder->GetItemCount())
   return CSize(0, 0);

Looks like a logic problem, should be || instead of &&... This sometimes crashes my application, however, the sample works fine despite this bug.



Replies:
Posted By: KirillMueller
Date Posted: 01 October 2007 at 4:24pm
In fact, my application even crashes when I fix this bug.

For some reason, m_nFirstItem becomes less than zero, and the code is not safe-guarded against this. In PaintItems, there is a loop

for (int i = m_nFirstItem; i < nItemCount; i++)

that accessess items with index i, and this fails if nFirstItem < 0.


Posted By: KirillMueller
Date Posted: 01 October 2007 at 4:50pm
My code set the currently selected item of a folder using SetSelItem while processing an OBN_XT_FOLDERCHANGE notification. This produced the apparently invalid state of m_nFirstItem < 0. Consider adding an ASSERT.


Posted By: Oleg
Date Posted: 02 October 2007 at 12:59am
Hi,
 
Thanks.
 
Actually CXTOutBarCtrl is very obsolete class, I recommend you use CXTPTaskPanel instead. See Samples\TaskPanel\* samples.


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


Posted By: KirillMueller
Date Posted: 02 October 2007 at 3:21am
Where do I find the TaskPanel samples? They're not under my

Xtreme Controls v11.2.0\Samples\Controls

folder.


Posted By: Oleg
Date Posted: 02 October 2007 at 5:49am
HI,
Sorry, it is part of Xtreme TaskPanel or Xtreme ToolkitPro only.


-------------
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