Daniel J Laird wrote:
I thought this might be the case,
Is there anyway to know I am shutting down?
I can see a shared->suspended flag but this is for something else.
Have we got a way of knowing we are shutting down?
What about this?
--
Best regards,
Denis Oliver Kropp
.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/ |
"------------------------------------------"
diff --git a/src/core/core.c b/src/core/core.c
index c6d97e1..b0d83c7 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -184,6 +184,7 @@ struct __DFB_CoreDFB {
bool master;
bool suspended;
+ bool shutdown;
DirectLink *cleanups;
@@ -629,6 +630,14 @@ dfb_core_is_master( CoreDFB *core )
return core->master;
}
+bool
+dfb_core_is_shutdown( CoreDFB *core )
+{
+ D_MAGIC_ASSERT( core, CoreDFB );
+
+ return core->shutdown;
+}
+
void
dfb_core_activate( CoreDFB *core )
{
@@ -911,6 +920,8 @@ dfb_core_shutdown( CoreDFB *core, bool emergency )
D_MAGIC_ASSERT( shared, CoreDFBShared );
+ core->shutdown = true;
+
/* Suspend input core to stop all input threads before shutting down. */
if (dfb_input_core.initialized)
dfb_input_core.Suspend( dfb_input_core.data_local );
diff --git a/src/core/core.h b/src/core/core.h
index 3de0912..58477dc 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -109,6 +109,11 @@ DirectResult dfb_core_enum_layer_regions ( CoreDFB *core,
bool dfb_core_is_master( CoreDFB *core );
/*
+ * Returns true if the core is in the shutdown process.
+ */
+bool dfb_core_is_shutdown( CoreDFB *core );
+
+/*
* Allows other (blocking) Fusionees to enter the DirectFB session.
*/
void dfb_core_activate( CoreDFB *core );
diff --git a/src/core/layer_control.c b/src/core/layer_control.c
index f794145..6ab5f14 100644
--- a/src/core/layer_control.c
+++ b/src/core/layer_control.c
@@ -482,7 +482,7 @@ dfb_layer_remove_context( CoreLayer *layer,
if (ctxs->primary)
D_ASSERT( fusion_vector_contains( &ctxs->stack, ctxs->primary ) );
- if (fusion_vector_has_elements( &ctxs->stack )) {
+ if (fusion_vector_has_elements( &ctxs->stack ) && !dfb_core_is_shutdown( layer->core )) {
CoreLayerContext *ctx;
/* Activate most recent context. */
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev