crash in wxListbook if imagelist is assigned after adding pages
|Reported by:||jens||Owned by:||vadz|
We use xrc-files to create settings dialogs in Code::Blocks.
We work on making the sources compatible with wx2.9.
After loading the dialog from the resource file, we create an imagelist and assign it to the dialog with AssignImageList.
Due to changes in wx2.9 this makes the whole application crash.
After some debugging I found the cause.
The listcontrol used by the listbook is always created with the flag wxLC_REPORT set, if CAN_USE_REPORT_VIEW is defined (all platforms except MAC).
If we now add pages before adding a imagelist the member-variable m_gi will not be initialised in the constructor of wxListLineData (explicitely set to NULL).
If we set an imagelist afterwards, the styles are changed and wxLC_REPORT is no longer set.
This leads to a crash at the beginning of wxListMainWindow::GetLineRect :
if ( !InReportView() ) return GetLine(line)->m_gi->m_rectAll;
The function InReportView() returns false because wxLC_REPORT is no longer set, but m_gi is NULL.
I attach a simple patch that always creates the GeometryInfo in wxListLineData.
This might not be the best solution, but it works.
The patch is against trunk, so the linenumbers might differ from wx2.9.
Change History (11)
comment:1 Changed 5 years ago by vadz
- Priority changed from critical to high
- Status changed from new to confirmed