On Tue, 1 Jul 2003 12:54:33 +0200 Xavier Nodet <[EMAIL PROTECTED]> wrote:
XN> if ( IsSorting() && !m_tableSort )
XN> {
XN> CHECK_RET( m_sizeTables, _T("Threading an empty list!!") );
XN> wxString msg = _("Sorting %lu messages...");
XN>
XN> if ( busy )
XN> busy->SetLabel(msg, m_sizeTables);
XN> else
XN> busy = new BusyIndicator(!m_firstSort, m_mf, msg, m_sizeTables);
XN>
XN> if ( !Sort() )
XN> {
XN> busy->Fail(_("Sorting failed!"));
XN> }
XN> CHECK_RET( m_sizeTables, _T("Threading an empty list!!") );
XN>
XN> How can you imagine that the assert on the last line of this code
XN> snippet is triggered!!
I can but only because I had already spent a few hours trying to
understand exactly the same problem a couple of months ago. I've fixed a
few places where it could happen but clearly not all :-(
Anyhow, thinking logically, what happens when we call wxYield()? First, we
may get OnIdle() events. But as wxMApp::Yield() sets a flag which OnIdle()
tests before starting to dispatch MEvents, this is not a danger any more.
Second, we may get WM_PAINT event and hence our OnPaint() or, in the case
of wxFolderListCtrl, OnGetItemXXX() (called from the controls own
OnPaint()) may be called.
There are some tests there but apparently m_mutexHeaders is not locked
when OnGetItemText() is called -- and this results in reentrancy and crash.
I see 2 solutions to this problem:
1. try to find the place from where the headers are being sorted/threaded
without locking m_mutexHeaders first
2. much dumber but potentially safer solution: simply call
mApplication->AllowBgProcessing() from OnGetItemXXX() functions and
return immediately without doing anything if it returns false.
I think (2) should really, really fix this problem. Could you please try
it out? Once again, for some reason (is my machine too slow? is my network
too fast?) I don't see these problems here and so can't test fixes for them.
Thanks a lot!
VZ
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Mahogany-Developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-developers