Cleanup: only add display when it's created

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.
This commit is contained in:
Jonathon Jongsma 2015-04-08 16:41:05 -05:00 committed by Fabiano Fidêncio
parent 7ddbd28756
commit c543941a17

View File

@ -727,10 +727,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++) {