[Spice-devel] [PATCH v2] server/red_dispatcher: fix wrong resolution set for tablet

Alon Levy alevy at redhat.com
Sun Jul 31 06:41:58 PDT 2011


when changing resolutions due to the new async code paths the surface
creation command was kept by reference, and later, when the red_worker
signaled completion by calling async_complete the mouse mode was updated
using the reference. This caused the wrong values to be read resulting in wrong
resolutions set and a non working mouse pointer. Fix this by keeping a copy of
the surface creation command instead of a reference.

No bz. Found in testing.
---
 server/red_dispatcher.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 7792d90..8f4a8a8 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -56,7 +56,7 @@ struct RedDispatcher {
     RedDispatcher *next;
     RedWorkerMessage async_message;
     pthread_mutex_t  async_lock;
-    QXLDevSurfaceCreate *surface_create;
+    QXLDevSurfaceCreate surface_create;
 };
 
 typedef struct RedWorkeState {
@@ -382,7 +382,7 @@ static void qxl_worker_destroy_primary_surface(QXLWorker *qxl_worker, uint32_t s
 
 static void red_dispatcher_create_primary_surface_complete(RedDispatcher *dispatcher)
 {
-    QXLDevSurfaceCreate *surface = dispatcher->surface_create;
+    QXLDevSurfaceCreate *surface = &dispatcher->surface_create;
 
     dispatcher->x_res = surface->width;
     dispatcher->y_res = surface->height;
@@ -390,7 +390,7 @@ static void red_dispatcher_create_primary_surface_complete(RedDispatcher *dispat
     dispatcher->primary_active = TRUE;
 
     update_client_mouse_allowed();
-    dispatcher->surface_create = NULL;
+    memset(&dispatcher->surface_create, sizeof(QXLDevSurfaceCreate), 0);
 }
 
 static void
@@ -408,7 +408,7 @@ red_dispatcher_create_primary_surface(RedDispatcher *dispatcher, uint32_t surfac
     } else {
         message = RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE;
     }
-    dispatcher->surface_create = surface;
+    dispatcher->surface_create = *surface;
 
     write_message(dispatcher->channel, &message);
     if (async) {
-- 
1.7.6



More information about the Spice-devel mailing list