Update of /cvsroot/mahogany/M/src/mail
In directory usw-pr-cvs1:/tmp/cvs-serv30537/src/mail

Modified Files:
        MailFolderCC.cpp 
Log Message:
fixed several crashes after recent changes when using uninitialized gs_StreamList

Index: MailFolderCC.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/MailFolderCC.cpp,v
retrieving revision 1.610
retrieving revision 1.611
diff -b -u -2 -r1.610 -r1.611
--- MailFolderCC.cpp    27 Apr 2002 21:48:21 -0000      1.610
+++ MailFolderCC.cpp    27 Apr 2002 22:41:36 -0000      1.611
@@ -2779,8 +2779,10 @@
    CHECK_STREAM_LIST();
 
-   size_t count = gs_StreamList->size();
+   size_t count = gs_StreamList ? gs_StreamList->size() : 0;
    MailFolder **mfOpened = new MailFolder *[count + 1];
 
    size_t n = 0;
+   if ( count )
+   {
    for ( StreamConnectionList::iterator i = gs_StreamList->begin();
          i != gs_StreamList->end();
@@ -2792,6 +2794,7 @@
       }
    }
+   }
 
-   // terminate the array
+   // always terminate the array with NULL
    mfOpened[n] = NULL;
 
@@ -2900,9 +2903,12 @@
    CHECK_STREAM_LIST();
 
-   which->clear();
-
    bool canExit = true;
-   StreamConnectionList::iterator i;
-   for(i = gs_StreamList->begin(); i != gs_StreamList->end(); i++)
+
+   if ( gs_StreamList )
+   {
+      which->clear();
+      for ( StreamConnectionList::iterator i = gs_StreamList->begin();
+            i != gs_StreamList->end();
+            ++i )
    {
       if( i->folder->InCritical() )
@@ -2912,4 +2918,5 @@
       }
    }
+   }
 
    return canExit;
@@ -2920,4 +2927,6 @@
 MailFolderCC *MailFolderCC::LookupStream(const MAILSTREAM *stream)
 {
+   CHECK( gs_StreamList, NULL, "shouldn't be called if uninitialized" );
+
    CHECK_STREAM_LIST();
 
@@ -2938,4 +2947,6 @@
 MailFolderCC::LookupObject(const MAILSTREAM *stream, const char *name)
 {
+   CHECK( gs_StreamList, NULL, "shouldn't be called if uninitialized" );
+
    MailFolderCC *mf = LookupStream(stream);
    if ( mf )
@@ -3032,4 +3043,7 @@
    wxLogTrace(TRACE_MF_CACHE, "MailFolderCC::RemoveFromMap() for folder %s",
               GetName().c_str());
+
+   CHECK_RET( gs_StreamList, "shouldn't be called if uninitialized" );
+
    CHECK_STREAM_LIST();
 


_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to