[wx-dev] wxGenericListCtrl: Fix assertion in wxListMainWindow::OnRenameTimer()

Vadim Zeitlin vadim at wxwindows.org
Sun Dec 3 05:50:21 PST 2006


On Sun, 03 Dec 2006 14:43:29 +0100 Tim Kosse <tim.kosse at gmx.de> wrote:

TK> Some of my users were reporting strange wxListCtrl problems, I finally
TK> managed to find a reason for it.
TK> If the current focus is resetted, it can happen that wxRenameTimer is
TK> still running, which will then call wxListMainWindow::OnRenameTimer()
TK> while m_current is -1.
TK> The proper solution is to always stop the timer if the current focus
TK> changes.

 This looks correct, thanks!

TK> TimIndex: src/generic/listctrl.cpp
TK> ===================================================================
TK> RCS file: /pack/cvsroots/wxwidgets/wxWidgets/src/generic/listctrl.cpp,v
TK> retrieving revision 1.436
TK> diff -u -r1.436 listctrl.cpp
TK> --- src/generic/listctrl.cpp	2006/12/01 23:51:49	1.436
TK> +++ src/generic/listctrl.cpp	2006/12/03 13:38:21
TK> @@ -2876,6 +2876,8 @@
TK>  {
TK>      m_current = current;
TK>  
TK> +    m_renameTimer->Stop();
TK> +
TK>      SendNotify(current, wxEVT_COMMAND_LIST_ITEM_FOCUSED);
TK>  }

 But shouldn't there be a "if ( m_renameTimer->IsRunning() )" test before
calling Stop()? I'd expect Stop() to assert if the timer is not currently
running and even if it doesn't do it now, it might start doing it in the
future.

 Regards,
VZ





More information about the wx-dev mailing list