[gnome-boxes] Wait for libvirt setup before creating VMs
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Wait for libvirt setup before creating VMs
- Date: Wed, 6 Jun 2012 02:00:16 +0000 (UTC)
commit b3547edeafe3a73c13b327380187e4667e443c5d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon May 21 19:12:00 2012 +0300
Wait for libvirt setup before creating VMs
There is a possibility that we attempt to create VM before the async
operation of creating libvirt connections is complete. When that
happens, we end up making calls to null connection.
https://bugzilla.gnome.org/show_bug.cgi?id=676216
src/vm-creator.vala | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index fba7a8a..8eaa8ba 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -5,7 +5,7 @@ using GVir;
private class Boxes.VMCreator {
private App app;
- private Connection connection { get { return app.default_connection; } }
+ private Connection? connection { get { return app.default_connection; } }
private VMConfigurator configurator;
private ulong stopped_id;
@@ -43,6 +43,17 @@ private class Boxes.VMCreator {
}
public async void create_and_launch_vm (InstallerMedia install_media, Cancellable? cancellable) throws GLib.Error {
+ if (connection == null) {
+ // Wait for needed libvirt connection
+ ulong handler = 0;
+ handler = app.notify["default-connection"].connect (() => {
+ create_and_launch_vm.callback ();
+ app.disconnect (handler);
+ });
+
+ yield;
+ }
+
var name = yield create_domain_name_from_media (install_media);
var fullscreen = true;
if (install_media is UnattendedInstaller) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]