]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/docview/doc.cpp
Rebake all the samples and others makefiles too.
[wxWidgets.git] / samples / docview / doc.cpp
index 24f3984b165033c74cc83840cbe4ea1c921c47f7..efdbf8adf7edd21ff11c7a8fe5db8c916e73fdb6 100644 (file)
@@ -79,6 +79,16 @@ DocumentIstream& DrawingDocument::LoadObject(DocumentIstream& istream)
 
     wxInt32 count = 0;
     stream >> count;
+    if ( count < 0 )
+    {
+        wxLogWarning("Drawing document corrupted: invalid segments count.");
+#if wxUSE_STD_IOSTREAM
+        istream.clear(std::ios::badbit);
+#else
+        istream.Reset(wxSTREAM_READ_ERROR);
+#endif
+        return istream;
+    }
 
     for ( int n = 0; n < count; n++ )
     {
@@ -186,7 +196,7 @@ bool wxTextDocument::OnCreate(const wxString& path, long flags)
     // when it's modified
     GetTextCtrl()->Connect
     (
-        wxEVT_COMMAND_TEXT_UPDATED,
+        wxEVT_TEXT,
         wxCommandEventHandler(wxTextDocument::OnTextChange),
         NULL,
         this