Bug #8444 2006-08-16 21:53
peterbostrom
Saved empty files areleft as Untitled# in Opened-Files list.
Created empty files are being left in the Opened-Files list, after saving them as something else, as Untitled1/Untitled# and are unclosable objects.
The new file name does not appear in the Opened-Files list. The tab does however get renamed.
Images:
http://lemming.armorycore.com/keep/cb-bug/
Code::Blocks Aug 16 Nightly
Windows XP
- Category
- Application::WrongBehaviour
- Group
- Status
- Closed
- Close date
- 2006-08-20 08:38
- Assigned to
History
I just looked into it. There are probably two problems involed.
First:
If the file is saved via 'File->Save' then EditorManager::Save or EditorManager::SaveActive is called. Both don't take into account that cbEditor::Save (which is called from both functions) may change the filename, if the file was never saved before. This is the case in this bug-report. Thus there should a check if the filename changed and if there was a change then EditorManager::RenameTreeFile should be called. But this would still suffer from the second issue:
Second:
If you use 'File->Save as' then EditorManager::SaveAs or EditorManager::SaveActiveAs is called. Both have a check whether the filename changed and call EditorManager::RenameTreeFile - but the problem appears to. The reason is: RenameTreeFile tries to find the editor belonging to the file which's filename shall be changed using it's old filename. But cbEditor::Save already changed the name thus the search doesn't bring up any result and the tree does not get updated.
I'm not sure how to solve this. It would probably work in this case if RenameTreeFile uses the new name to find the editor and the old name to find the tree item - but will this work in everywhere when EditorManager::RenameTreeFile is called?
OK, I just tested my last suggestion and it seems to fix these to problems. I posted this patch on berlios, patch #1361.
This bug is now fixed in HEAD.
Thank you for reporting it.