Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: sethjackson on December 22, 2006, 09:24:54 pm

Title: Another bug
Post by: sethjackson on December 22, 2006, 09:24:54 pm
Here is how to reproduce.

1. File -> New -> Empty file
2. If C::B asks you to add the file to the active project hit no
3. File -> Save
4. Hit cancel in the Save as dialog
5. Bingo

Now here is my one liner HACK fix. This IS NOT an acceptable way to fix the bug.....

Code
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp (revision 3413)
+++ src/sdk/cbeditor.cpp (working copy)
@@ -1267,7 +1267,7 @@
     dlg->SetFilterIndex(StoredIndex);
     PlaceWindow(dlg);
     if (dlg->ShowModal() != wxID_OK)
-        return false;
+        return true;
     m_Filename = dlg->GetPath();
     LOGSTREAM << m_Filename << _T('\n');
     fname.Assign(m_Filename);


If you want to know why this "works" trace through from MainFrame::OnFileSave()....... Which leads to EditorManager::SaveActive().

I'm sure a dev has a good way to fix this, but I can't think of one right now. :P
Title: Re: Another bug
Post by: Der Meister on December 22, 2006, 09:41:35 pm
This patch pretends that the file was saved correctly in order to suppres the annoying "The file could not be saved" message box? Well, then it is really a hack  :shock:
Title: Re: Another bug
Post by: sethjackson on December 22, 2006, 09:45:24 pm
This patch pretends that the file was saved correctly in order to suppres the annoying "The file could not be saved" message box? Well, then it is really a hack  :shock:

Yeah. That is why I bolded hack.  :P

EDIT:

Ok hopefully it is more clear now. ;)