Hi,
When using SaWMan on Sigma Designs hardware, it tries to create windows
on layers without surface capability. This causes a segmentation fault.
I'm attaching a patch that fixes the problem.
Sorin
diff -u -r1.15 layer_context.c
--- src/core/layer_context.c 9 Oct 2009 21:05:47 -0000 1.15
+++ src/core/layer_context.c 10 Nov 2009 15:46:11 -0000
@@ -152,7 +152,7 @@
/**********************************************************************************************************************/
static void
-update_stack_geometry( CoreLayerContext *context )
+update_context_geometry( CoreLayerContext *context )
{
DFBDimension size;
int rotation;
@@ -191,7 +191,8 @@
}
}
- dfb_windowstack_resize( context->stack, size.w, size.h, rotation );
+ if (context->stack)
+ dfb_windowstack_resize( context->stack, size.w, size.h, rotation );
}
DFBResult
@@ -251,15 +252,17 @@
dfb_layer_context_lock( context );
/* Create the window stack. */
- context->stack = dfb_windowstack_create( context );
- if (!context->stack) {
- dfb_layer_context_unlock( context );
- dfb_layer_context_unref( context );
- return D_OOSHM();
+ if (layer->shared->description.caps & DLCAPS_SURFACE) {
+ context->stack = dfb_windowstack_create( context );
+ if (!context->stack) {
+ dfb_layer_context_unlock( context );
+ dfb_layer_context_unref( context );
+ return D_OOSHM();
+ }
}
/* Tell the window stack about its size. */
- update_stack_geometry( context );
+ update_context_geometry( context );
dfb_layer_context_unlock( context );
@@ -844,7 +847,7 @@
if (config->flags & (DLCONF_WIDTH | DLCONF_HEIGHT |
DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | DLCONF_SURFACE_CAPS))
{
- update_stack_geometry( context );
+ update_context_geometry( context );
/* FIXME: call only if really needed */
dfb_windowstack_repaint_all( stack );
@@ -1224,9 +1227,10 @@
if (context->rotation != rotation) {
context->rotation = rotation;
- update_stack_geometry( context );
+ update_context_geometry( context );
- dfb_windowstack_repaint_all( context->stack );
+ if (context->stack)
+ dfb_windowstack_repaint_all( context->stack );
}
/* Unlock the context. */
@@ -1397,13 +1401,17 @@
D_DEBUG_AT( Core_LayerContext, "%s( %p, %p, %p, %p )\n", __FUNCTION__, core, context, desc, ret_window );
D_MAGIC_ASSERT( context, CoreLayerContext );
- D_ASSERT( context->stack != NULL );
D_ASSERT( desc != NULL );
D_ASSERT( ret_window != NULL );
layer = dfb_layer_at( context->layer_id );
- D_ASSERT( layer != NULL );
+ if ((layer->shared->description.caps & DLCAPS_SURFACE) == 0)
+ return DFB_UNSUPPORTED;
+
+ D_ASSERT( context->stack != NULL );
+
+ D_ASSERT( layer != NULL );
D_ASSERT( layer->funcs != NULL );
if (dfb_layer_context_lock( context ))
@@ -1437,13 +1445,20 @@
{
CoreWindowStack *stack;
CoreWindow *window;
+ CoreLayer *layer;
D_DEBUG_AT( Core_LayerContext, "%s( %p, %u )\n", __FUNCTION__, context, id );
D_MAGIC_ASSERT( context, CoreLayerContext );
- D_ASSERT( context->stack != NULL );
- stack = context->stack;
+ layer = dfb_layer_at( context->layer_id );
+
+ if ((layer->shared->description.caps & DLCAPS_SURFACE) == 0)
+ return NULL;
+
+ D_ASSERT( context->stack != NULL );
+
+ stack = context->stack;
if (dfb_layer_context_lock( context ))
return NULL;
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev