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

Modified Files:
        wxFolderView.cpp 
Log Message:
fixed crash when we had an incorrect (or simply old) folder columns widths entry in 
the profile

Index: wxFolderView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFolderView.cpp,v
retrieving revision 1.592
retrieving revision 1.593
diff -b -u -2 -r1.592 -r1.593
--- wxFolderView.cpp    3 Jul 2002 17:31:14 -0000       1.592
+++ wxFolderView.cpp    4 Jul 2002 14:09:26 -0000       1.593
@@ -953,4 +953,10 @@
 
 // return columns widths from the given string
+//
+// NB: this should be only called for the string returned by GetColWidths() and
+//     never for the widths read from the profile for which
+//     NormalizeColumnWidths() must be used as the code expects the returned
+//     array to always have the correct number of elements which can be not the
+//     case if we have incorrect profile entry
 static wxArrayString UnpackWidths(const wxString& s)
 {
@@ -2428,10 +2434,15 @@
    if ( str != FOLDER_LISTCTRL_WIDTHS_D && str != GetColWidths() )
    {
-      // check if the only difference if for the columns we don't show anyhow:
+      // check if the only difference is for the columns we don't show anyhow:
       // this is needed to avoid always writing the widths for a folder which
       // just doesn't show one of the columns shown by default, it would have
       // "-1"s instead of the global values then
-      wxArrayString widthsOld = UnpackWidths(GetColWidths()),
+      wxArrayString widthsOld = NormalizeColumnWidths(GetColWidths()),
                     widthsNew = UnpackWidths(str);
+
+      CHECK_RET( widthsOld.GetCount() == WXFLC_NUMENTRIES &&
+                 widthsNew.GetCount() == WXFLC_NUMENTRIES,
+                 "invalid widths array element count" );
+
       size_t col;
       for ( col = 0; col < WXFLC_NUMENTRIES; col++ )



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Caffeinated soap. No kidding.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to