[gnome-boxes/gnome-3-8] installer: Introducing clean_up_preparation_cache method



commit 645a32d45a8beb1d294bcc151ec9c7dcde49edec
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue May 21 22:28:32 2013 +0300

    installer: Introducing clean_up_preparation_cache method
    
    Add a separate method for cleaning up any cache created by 'prepare'
    method that need to be kept around until VM is created and launched. This
    is kept separate from 'clean_up' method as that is meant to clean data
    that is needed until VM is completely installed. To ensure
    clean_up_preparation_cache is always called, we also call it from
    'clean_up' method.
    
    This fixes the issue of setup->review->setup->review wizard transition,
    while keeping express installation selected, resulting in an error that
    was triggered by us not passing any file arguments to mkisofs command as
    we were already emptying the list of files.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700470

 src/installer-media.vala      |    5 ++++-
 src/unattended-installer.vala |   10 +++++++---
 src/wizard.vala               |    1 +
 3 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 8cda645..7b567ab 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -74,7 +74,10 @@ private class Boxes.InstallerMedia : GLib.Object {
                                        Cancellable? cancellable = null) {}
     public virtual async void prepare_for_installation (string vm_name, Cancellable? cancellable) throws 
GLib.Error {}
     public virtual void prepare_to_continue_installation (string vm_name) {}
-    public virtual void clean_up () {}
+    public virtual void clean_up () {
+        clean_up_preparation_cache ();
+    }
+    public virtual void clean_up_preparation_cache () {} // Clean-up any cache needed for preparing the new 
VM.
 
     public virtual void setup_domain_config (Domain domain) {
         add_cd_config (domain, from_image? DomainDiskType.FILE : DomainDiskType.BLOCK, device_file, "hdc", 
true);
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index ecfb421..b0814a4 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -209,9 +209,6 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
             express_toggle.active = false;
 
             throw error;
-        } finally {
-            unattended_files = null;
-            secondary_unattended_files = null;
         }
     }
 
@@ -346,6 +343,13 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
         }
     }
 
+    public override void clean_up_preparation_cache () {
+        base.clean_up_preparation_cache ();
+
+        unattended_files = null;
+        secondary_unattended_files = null;
+    }
+
     public string get_user_unattended (string? suffix = null) {
         var filename = hostname;
         if (suffix != null)
diff --git a/src/wizard.vala b/src/wizard.vala
index cd30fd5..93a20cb 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -210,6 +210,7 @@ private class Boxes.Wizard: Boxes.UI {
                 return false;
             }
 
+            vm_creator.install_media.clean_up_preparation_cache ();
             vm_creator = null;
             wizard_source.uri = "";
         } else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]