]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/appcmn.cpp
Fixed ReadLine missing last character from text files with no final newline.
[wxWidgets.git] / src / common / appcmn.cpp
index d37a9be4acf8876816e714ce6535e72fbd338427..4cc829b6738306055afdb0dd78cc9ce4e6760667 100644 (file)
@@ -31,7 +31,6 @@
     #include "wx/intl.h"
     #include "wx/log.h"
     #include "wx/msgdlg.h"
-    #include "wx/bitmap.h"
     #include "wx/confbase.h"
     #include "wx/utils.h"
 #endif
@@ -367,11 +366,14 @@ void wxAppBase::DeletePendingObjects()
     {
         wxObject *obj = node->GetData();
 
-        delete obj;
-
-        if (wxPendingDelete.Member(obj))
+        // remove it from the list first so that if we get back here somehow
+        // during the object deletion (e.g. wxYield called from its dtor) we
+        // wouldn't try to delete it the second time
+        if ( wxPendingDelete.Member(obj) )
             wxPendingDelete.Erase(node);
 
+        delete obj;
+
         // Deleting one object may have deleted other pending
         // objects, so start from beginning of list again.
         node = wxPendingDelete.GetFirst();