Hi all,

I've found a problem in layer_context.c (for which I'm attaching a patch).
It basically manifests itself by triggering an assert in set_region if a layer that previously had a surface source switches to a surface-less source (e.g. video). The bug is caused by the destruction of the region surface before the active buffer is unlocked (the lock is being held by the layer).

Sorin
diff -b -u -r1.1 layer_context.c
--- layer_context.c	2 Apr 2009 15:03:34 -0000	1.1
+++ layer_context.c	9 Apr 2009 15:14:30 -0000
@@ -727,11 +727,8 @@
 
                D_FLAGS_CLEAR( region->state, CLRSF_CONFIGURED );
 
-               /* (Re)allocate the region's surface. */
-               if (surface) {
-                    flags |= CLRCF_SURFACE | CLRCF_PALETTE;
-
-                    if (region->surface) {
+               /* Unlock the region surface */
+               if (region->surface)
                          if (D_FLAGS_IS_SET( region->state, CLRSF_REALIZED )) {
                               if (!D_FLAGS_IS_SET( region->state, CLRSF_FROZEN ))
                                    D_ASSUME( region->surface_lock.buffer != NULL );
@@ -740,6 +737,11 @@
                                    dfb_surface_unlock_buffer( region->surface, &region->surface_lock );
                          }
 
+               /* (Re)allocate the region's surface. */
+               if (surface) {
+                    flags |= CLRCF_SURFACE | CLRCF_PALETTE;
+
+                    if (region->surface) {
                          ret = DFB_OK;
                          if (surface_changed)
                               ret = reallocate_surface( layer, region, &region_config );
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to