I have made a new change.

in src/idirectfb.c - > Destruct

/*
 * Destructor
 *
 * Free data structure and set the pointer to NULL,
 * to indicate the dead interface.
 */
void
IDirectFB_Destruct( IDirectFB *thiz )
{
     int             i;
     IDirectFB_data *data = (IDirectFB_data*)thiz->priv;

     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );

     drop_window( data );

     for (i=0; i<MAX_LAYERS; i++) {
          if (data->layers[i].context) {
               if (data->layers[i].palette)
                    dfb_palette_unref( data->layers[i].palette );

               D_DEBUG_AT( IDFB, "%s: Layer idx = %d\n", __FUNCTION__, i);
               D_DEBUG_AT( IDFB, "%s: Calling dfb_surface_unref\n", 
__FUNCTION__ );
               dfb_surface_unref( data->layers[i].surface );
               D_DEBUG_AT( IDFB, "%s: Calling dfb_layer_region_unref\n", 
__FUNCTION__ );
               dfb_layer_region_unref( data->layers[i].region );
               D_DEBUG_AT( IDFB, "%s: Calling dfb_layer_context_unref\n", 
__FUNCTION__ );
               dfb_layer_context_unref( data->layers[i].context );
          }
     }

     D_DEBUG_AT( IDFB, "%s: Calling dfb_surface_unref DJL\n", __FUNCTION__ );
     dfb_layer_context_unref( data->context );

     if (data->primary.context)
     {
         D_DEBUG_AT( IDFB, "%s: Calling dfb_layer_context_unref for PRIMARY\n", 
__FUNCTION__ );
         dfb_layer_context_unref( data->primary.context );
     }

     D_DEBUG_AT( IDFB, "%s: Calling dfb_core_destroy\n", __FUNCTION__ );
     dfb_core_destroy( data->core, false );

     idirectfb_singleton = NULL;

     DIRECT_DEALLOCATE_INTERFACE( thiz );

     direct_shutdown();
}

I have moved the primary context_unref and data->context unref to after the for 
loop.

>From my debug this means that all resources are freed by the for loop and then 
>when it unrefs the primary context it
does not call activate/

Are there any issues with this solution that I can't see.
My apps all seem to be running ok but there is always at least one usecase that 
I miss!

Cheers
Daniel Laird

-----Original Message-----
From: Denis Oliver Kropp [mailto:[EMAIL PROTECTED]
Sent: 2008 Oct 15 09:11
To: Daniel J Laird
Cc: directfb-dev@directfb.org
Subject: Re: Layer Clearing at shutdown in DFB 1.2.x

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/                 |
"------------------------------------------"
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to