Revision: 7388
          http://mahogany.svn.sourceforge.net/mahogany/?rev=7388&view=rev
Author:   vadz
Date:     2007-11-20 07:55:21 -0800 (Tue, 20 Nov 2007)

Log Message:
-----------
don't lock m_mutexHeaders twice when retrieving a header which we hadn't been 
able to get previously from OnSelected()

Modified Paths:
--------------
    trunk/M/src/gui/wxFolderView.cpp

Modified: trunk/M/src/gui/wxFolderView.cpp
===================================================================
--- trunk/M/src/gui/wxFolderView.cpp    2007-11-15 14:43:17 UTC (rev 7387)
+++ trunk/M/src/gui/wxFolderView.cpp    2007-11-20 15:55:21 UTC (rev 7388)
@@ -542,7 +542,7 @@
       CHECK( (size_t)item < GetHeadersCount(), UID_ILLEGAL,
              _T("invalid listctrl index") );
 
-      MLocker lock(((wxFolderListCtrl *)this)->m_mutexHeaders);
+      MLocker lock(m_mutexHeaders);
 
       HeaderInfo *hi = m_headers->GetItem((size_t)item);
       return hi ? hi->GetUId() : UID_ILLEGAL;
@@ -692,8 +692,8 @@
    /// the listing to use
    HeaderInfoList *m_headers;
 
-   /// are we inside a call to some HeaderInfoList method?
-   MMutex m_mutexHeaders;
+   /// lock this before calling an m_headers method and unlock on return
+   mutable MMutex m_mutexHeaders;
 
    /// cached header info (used by OnGetItemXXX())
    HeaderInfo *m_hiCached;
@@ -1845,14 +1845,17 @@
 
       if ( uid == UID_ILLEGAL )
       {
-         MLocker lock(m_mutexHeaders);
-
-         if ( !m_headers->ReallyGet(m_itemFocus) )
          {
-            // we failed to get it, what can we do?
-            return;
-         }
+            MLocker lock(m_mutexHeaders);
 
+            if ( !m_headers->ReallyGet(m_itemFocus) )
+            {
+               // we failed to get it, what can we do?
+               return;
+            }
+         } // unlock m_mutexHeaders before calling GetUIdFromIndex() which
+           // locks it internally
+
          uid = GetUIdFromIndex(m_itemFocus);
 
          ASSERT_MSG( uid != UID_ILLEGAL, _T("invalid uid after ReallyGet()?") 
);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to