<div dir="ltr">ack<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 8, 2013 at 4:06 PM, Yonit Halperin <span dir="ltr"><<a href="mailto:yhalperi@redhat.com" target="_blank">yhalperi@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
server/red_worker.c | 36 +++++++++++++++++++++++++-----------<br>
1 file changed, 25 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/server/red_worker.c b/server/red_worker.c<br>
index 247f153..f12d8f8 100644<br>
--- a/server/red_worker.c<br>
+++ b/server/red_worker.c<br>
@@ -10099,16 +10099,20 @@ static uint64_t display_channel_handle_migrate_data_get_serial(<br>
return migrate_data->message_serial;<br>
}<br>
<br>
-static void display_channel_client_restore_surface(DisplayChannelClient *dcc, uint32_t surface_id)<br>
+static int display_channel_client_restore_surface(DisplayChannelClient *dcc, uint32_t surface_id)<br>
{<br>
/* we don't process commands till we receive the migration data, thus,<br>
* we should have not sent any surface to the client. */<br>
- spice_assert(!dcc->surface_client_created[surface_id]);<br>
+ if (dcc->surface_client_created[surface_id]) {<br>
+ spice_warning("surface %u is already marked as client_created", surface_id);<br>
+ return FALSE;<br>
+ }<br>
dcc->surface_client_created[surface_id] = TRUE;<br>
+ return TRUE;<br>
}<br>
<br>
-static void display_channel_client_restore_surfaces_lossless(DisplayChannelClient *dcc,<br>
- MigrateDisplaySurfacesAtClientLossless *mig_surfaces)<br>
+static int display_channel_client_restore_surfaces_lossless(DisplayChannelClient *dcc,<br>
+ MigrateDisplaySurfacesAtClientLossless *mig_surfaces)<br>
{<br>
uint32_t i;<br>
<br>
@@ -10116,11 +10120,14 @@ static void display_channel_client_restore_surfaces_lossless(DisplayChannelClien<br>
for (i = 0; i < mig_surfaces->num_surfaces; i++) {<br>
uint32_t surface_id = mig_surfaces->surfaces[i].id;<br>
<br>
- display_channel_client_restore_surface(dcc, surface_id);<br>
+ if (!display_channel_client_restore_surface(dcc, surface_id)) {<br>
+ return FALSE;<br>
+ }<br>
}<br>
+ return TRUE;<br>
}<br>
<br>
-static void display_channel_client_restore_surfaces_lossy(DisplayChannelClient *dcc,<br>
+static int display_channel_client_restore_surfaces_lossy(DisplayChannelClient *dcc,<br>
MigrateDisplaySurfacesAtClientLossy *mig_surfaces)<br>
{<br>
uint32_t i;<br>
@@ -10131,7 +10138,9 @@ static void display_channel_client_restore_surfaces_lossy(DisplayChannelClient *<br>
SpiceMigrateDataRect *mig_lossy_rect;<br>
SpiceRect lossy_rect;<br>
<br>
- display_channel_client_restore_surface(dcc, surface_id);<br>
+ if (!display_channel_client_restore_surface(dcc, surface_id)) {<br>
+ return FALSE;<br>
+ }<br>
spice_assert(dcc->surface_client_created[surface_id]);<br>
<br>
mig_lossy_rect = &mig_surfaces->surfaces[i].lossy_rect;<br>
@@ -10142,6 +10151,7 @@ static void display_channel_client_restore_surfaces_lossy(DisplayChannelClient *<br>
region_init(&dcc->surface_client_lossy_region[surface_id]);<br>
region_add(&dcc->surface_client_lossy_region[surface_id], &lossy_rect);<br>
}<br>
+ return TRUE;<br>
}<br>
static int display_channel_handle_migrate_data(RedChannelClient *rcc, uint32_t size,<br>
void *message)<br>
@@ -10151,6 +10161,7 @@ static int display_channel_handle_migrate_data(RedChannelClient *rcc, uint32_t s<br>
DisplayChannel *display_channel = SPICE_CONTAINEROF(rcc->channel, DisplayChannel, common.base);<br>
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);<br>
uint8_t *surfaces;<br>
+ int surfaces_restored = FALSE;<br>
int i;<br>
<br>
spice_debug(NULL);<br>
@@ -10214,13 +10225,16 @@ static int display_channel_handle_migrate_data(RedChannelClient *rcc, uint32_t s<br>
<br>
surfaces = (uint8_t *)message + migrate_data->surfaces_at_client_ptr;<br>
if (display_channel->enable_jpeg) {<br>
- display_channel_client_restore_surfaces_lossy(dcc,<br>
- (MigrateDisplaySurfacesAtClientLossy *)surfaces);<br>
+ surfaces_restored = display_channel_client_restore_surfaces_lossy(dcc,<br>
+ (MigrateDisplaySurfacesAtClientLossy *)surfaces);<br>
} else {<br>
- display_channel_client_restore_surfaces_lossless(dcc,<br>
- (MigrateDisplaySurfacesAtClientLossless*)surfaces);<br>
+ surfaces_restored = display_channel_client_restore_surfaces_lossless(dcc,<br>
+ (MigrateDisplaySurfacesAtClientLossless*)surfaces);<br>
}<br>
<br>
+ if (!surfaces_restored) {<br>
+ return FALSE;<br>
+ }<br>
red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_INVAL_PALLET_CACHE);<br>
/* enable sending messages */<br>
red_channel_client_ack_zero_messages_window(rcc);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.4<br>
<br>
_______________________________________________<br>
Spice-devel mailing list<br>
<a href="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/spice-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/spice-devel</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Marc-André Lureau
</div>