Daniel J Laird wrote:
> 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!
No, I think this looks like a good idea.
--
Best regards,
Denis Oliver Kropp
.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/ |
"------------------------------------------"
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev