Actual source code (codesnippetstreectrl.cpp) have :
//-wrong--SetItemText(snippetID, pcbEditor->GetName());
//-SetFileChanged(true);
}
I understand that SetItemText and SetFileChanged are commented out for some reason (I don't know)
1)I create a new snippet, made modifications, save it and close C::B
I reopen C::B, snippet is here with data. Good.
2)I open this existant snippet (it open in a cbEditor window), made some change, hit close. I have question "Do you want to save temp_directory\snippet name.txt ?". I say Yes.
Next I close codeblocks. I reopen C::B, snippet modifications are lost.
If I uncomment SetFileChanged(true); it works correctly in second "edit only" case.
In my understanding, save of snippet data is a 2 step process. First, save edited snippet to internal XML data (attached to CodeSnippet treeview). Here it goes well. Second stage is saving whole XML code snippets to file.This is done on app closing.
But If this SetFileChanged(true); have been commented I suppose there is others usages where it's a problem ...
Note even with this modification, there is another race case. If I edit a snippet, but I don't save cbEditor window before closing C::B, OnClose of cbEditor will be called after CodeSnippet one. So here too, data will be lost.
I don't know which method is best to solve this :
-I can't postpone saving XML data on second OnRelease call, as window treeview that handled data would have been destroyed at this time
-If CodeSnippet have an internal list of cbEditor that it handle probably a solution is to request a close of them before saving XML data in OnRelease()
[Minor editing for better understanting]