fetcher git: also dispose git process on dispose

This commit is contained in:
Hylke Bons 2012-04-18 11:52:45 +02:00
parent 145e8fe01d
commit 1dd617648a
2 changed files with 21 additions and 14 deletions

View file

@ -188,10 +188,16 @@ namespace SparkleLib.Git {
this.git.Dispose ();
} catch (Exception e) {
SparkleHelpers.DebugInfo ("Fetcher", "Failed to cancel properly: " + e.Message);
SparkleHelpers.DebugInfo ("Fetcher", "Failed to dispose properly: " + e.Message);
}
Dispose ();
base.Dispose ();
}
new public void Dispose ()
{
Stop ();
}

View file

@ -968,21 +968,22 @@ namespace SparkleShare {
bool target_folder_exists = Directory.Exists (
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, canonical_name));
// Add a numbered suffix to the name if a folder with the same name
// already exists. Example: "Folder (2)"
int i = 1;
while (target_folder_exists) {
i++;
target_folder_exists = Directory.Exists (
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, canonical_name + " (" + i + ")"));
}
string target_folder_name = canonical_name;
if (i > 1)
target_folder_name += " (" + i + ")";
this.fetcher.Finished += delegate (string [] warnings) {
// Add a numbered suffix to the name if a folder with the same name
// already exists. Example: "Folder (2)"
int i = 1;
while (target_folder_exists) {
i++;
target_folder_exists = Directory.Exists (
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, canonical_name + " (" + i + ")"));
}
string target_folder_name = canonical_name;
if (i > 1)
target_folder_name += " (" + i + ")";
// Needed to do the moving
SparkleHelpers.ClearAttributes (tmp_folder);
string target_folder_path = Path.Combine (