[virt-tools-list] [PATCH virt-viewer 2/2] Cleanup: only add display when it's created
Jonathon Jongsma
jjongsma at redhat.com
Wed Apr 8 21:41:05 UTC 2015
This wasn't causing any problems because the _add_display() function has
an early return for the case that the display has already been added to
the session, but it's quite confusing when reading the code to see this
_add_display() function being called for every display every time we get
a monitor configuration update.
---
src/virt-viewer-session-spice.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 4fdab2b..3a7e230 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -721,10 +721,9 @@ virt_viewer_session_spice_display_monitors(SpiceChannel *channel,
display = virt_viewer_display_spice_new(self, channel, i);
g_debug("creating spice display (#:%d)", i);
g_ptr_array_index(displays, i) = g_object_ref_sink(display);
+ virt_viewer_session_add_display(VIRT_VIEWER_SESSION(self),
+ VIRT_VIEWER_DISPLAY(display));
}
-
- virt_viewer_session_add_display(VIRT_VIEWER_SESSION(self),
- VIRT_VIEWER_DISPLAY(display));
}
for (i = 0; i < monitors->len; i++) {
--
2.1.0
More information about the virt-tools-list
mailing list