On Mon, 28 Oct 2013 22:24:13 +0100 (CET) Jan Engelhardt wrote:
JE> Running valgrind over one of my programs I notice the following problem
JE> (line numbers are wx 2.9.4).
JE>
JE> ==4680== Conditional jump or move depends on uninitialised value(s)
JE> ==4680== at 0x5A32C95: wxSelectionStore::SetItemCount(unsigned int) (selstore.cpp:221)
JE> ==4680== by 0x58D17CF: wxListMainWindow::SetItemCount(long) (listctrl.cpp:3389)
JE> ==4680== by 0x437445: MyGrid::show_stuff() (mainmenu.cpp:1138)
JE>
JE> In selstore:221, we find
JE>
JE> void wxSelectionStore::SetItemCount(unsigned count)
JE> {
JE> // forget about all items whose indices are now invalid if the size
JE> // decreased
JE> ==> if ( count < m_count )
JE>
JE> however, m_count was never initialized, because selstore.h just reads:
JE>
JE> class WXDLLIMPEXP_CORE wxSelectionStore
JE> {
JE> public:
JE> ==> wxSelectionStore() : m_itemsSel(wxUIntCmp) { Init(); }
JE>
JE> This is triggerable when you have a just-instantiated
JE> wxLC_REPORT|wxLC_VIRTUAL wxListCtrl and then call SetItemCount on it.
JE>
JE> From a source-only look, the problem seems to be still present in
JE> 3.0.0-rc2.
This actually looks harmless, because whichever branch of the "if" flagged
above is taken doesn't matter for a freshly created wxSelectionStore, but
it's still better to fix this, of course, so I've just done it in r75094,
thanks for reporting this!
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/