remove knowledge of defaultallocator_free_displaysurface from sdl.c
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 10 Feb 2010 23:29:56 +0000 (00:29 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 19 Feb 2010 21:18:16 +0000 (15:18 -0600)
Let register_displayallocator hand over the old width/height to the new
allocator.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
sdl.c
vl.c

diff --git a/sdl.c b/sdl.c
index cf27ad2..a9b4323 100644 (file)
--- a/sdl.c
+++ b/sdl.c
@@ -872,10 +872,6 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
     da->resize_displaysurface = sdl_resize_displaysurface;
     da->free_displaysurface = sdl_free_displaysurface;
     if (register_displayallocator(ds, da) == da) {
-        DisplaySurface *surf;
-        surf = sdl_create_displaysurface(ds_get_width(ds), ds_get_height(ds));
-        defaultallocator_free_displaysurface(ds->surface);
-        ds->surface = surf;
         dpy_resize(ds);
     }
 
diff --git a/vl.c b/vl.c
index bfbd0af..599a080 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -2615,7 +2615,13 @@ DisplayState *get_displaystate(void)
 
 DisplayAllocator *register_displayallocator(DisplayState *ds, DisplayAllocator *da)
 {
-    if(ds->allocator ==  &default_allocator) ds->allocator = da;
+    if(ds->allocator ==  &default_allocator) {
+        DisplaySurface *surf;
+        surf = da->create_displaysurface(ds_get_width(ds), ds_get_height(ds));
+        defaultallocator_free_displaysurface(ds->surface);
+        ds->surface = surf;
+        ds->allocator = da;
+    }
     return ds->allocator;
 }