Hey guys,
I'm currently working on removing files with GitBlocks. My current code looks like this:
void GitBlocks::Remove(wxCommandEvent &event)
{
RemoveDialog dialog(Manager::Get()->GetAppWindow());
if(dialog.ShowModal() == wxID_OK)
{
wxString filename = dialog.FileChoice->GetString(dialog.FileChoice->GetCurrentSelection());
cbProject *project = Manager::Get()->GetProjectManager()->GetActiveProject();
ProjectFile *file = project->GetFile(dialog.FileChoice->GetCurrentSelection());
if(file == NULL)
return;
project->BeginRemoveFiles();
project->RemoveFile(file);
project->EndRemoveFiles();
if(filename.empty())
return;
Execute(git + _T(" rm ") + filename, _("Removing file ..."));
}
}
dialog.FileChoice is a wxChoice that is filled with the names of the files in the project. Execute() is a function that basically executes the first parameter and logs the second parameter (and does some other logging stuff).For some reason, it removes the file just fine and it also closes the files editing tab in C::B, but it doesn't disappear in the project manager panel. If I then open the file by double-clicking it, C::B crashes.
(I'm on a different computer right know, so I can't include a crash report.)
Does anybody know what I do wrong / what's still missing?
Thanks in advance!