[Solved] CXTPMarkupListBox crashes on empty list |
Post Reply |
Author | |
sdancer75
Groupie Joined: 08 July 2008 Location: Greece Status: Offline Points: 70 |
Post Options
Thanks(0)
Posted: 28 January 2020 at 3:49am |
Version : 15.x 16.x and maybe newer versions Symptoms : CXTPMarkupListBox and CXTPListBox crashes when the list box is empty and move mouse inside its client area. Problem : Inside void CXTPListBox::OnMouseMove(UINT nFlags, CPoint point) the MFC function ItemFromPoint() returns a WORD (not signed) value of 65535 which means invalid or empty list. This value is returned to nHotItem. int nHotItem = ItemFromPoint(point, bOutside) The signed int nHotItem is now 4 bytes so instead of converting the non signed word 65535 to -1, it remains 65535. After this, the code is calling BOOL CXTPMarkupListBox::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult) which in turn is calling an invalid item in code below. XTP_MARKUP_LISTITEM *pItem = reinterpret_cast<XTP_MARKUP_LISTITEM*>(GetItemDataPtr(m_nHotItem)); At this point the code crashes. Solution Inside void CXTPListBox::OnMouseMove(UINT nFlags, CPoint point) declare nHotItem as short int instead of an int like below. short int nHotItem = ItemFromPoint(point, bOutside) Recompile all codejock libs and rebuild your project.
|
|
Just me!
|
|
Fredrik
Senior Member Joined: 22 June 2005 Status: Offline Points: 235 |
Post Options
Thanks(0)
|
Just looked at the code in version 18.x and 19 it's fixed there.
|
|
Windows 10, Visual Studio 20157, Toolkit Pro 18.3.0
|
|
sdancer75
Groupie Joined: 08 July 2008 Location: Greece Status: Offline Points: 70 |
Post Options
Thanks(0)
|
Thanks |
|
Just me!
|
|
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 |