Hi,

The attached test case crashes consistently when run against DirectFB-1.6.3
including on x86.

I  spent some time debugging it, and it's likely a memory corruption being
the root cause (btw, there are many data races going on between the main
thread and the reference watcher thread).

Any clues on what might be going on?

Ilyes
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <directfb.h>
#include <idirectfb.h>
#include <display/idirectfbsurface.h>

int
main( int argc, char *argv[] )
{
     int                     i;
     DFBResult               ret;
     IDirectFB              *dfb;

     ret = DirectFBInit( &argc, &argv );
     if (ret) {
          D_DERROR( ret, "JPEG: DirectFBInit() failed!\n" );
          return ret;
     }

     ret = DirectFBCreate( &dfb );
     if (ret) {
          D_DERROR( ret, "JPEG: DirectFBCreate() failed!\n" );
          return ret;
     }

     dfb->SetCooperativeLevel( dfb, DFSCL_EXCLUSIVE );

      for (i = 0; i < 1024 * 128; i++)
     {
          IDirectFB_data *data = (IDirectFB_data*)dfb->priv;

          CoreSurfaceConfig config;
          CoreSurfaceBufferLock src_lock = { .pitch = 0 };

          CoreSurface* surface;

          config.size.w = 256;
          config.size.h = 256;
          config.format = DSPF_NV12;

          dfb_surface_create_simple( data->core,
                                     config.size.w,
                                     config.size.h,
                                     config.format,
                                     DSCS_BT601,
                                     DSCAPS_VIDEOONLY,
                                     CSTF_EXTERNAL,
                                     0,
                                     NULL,
                                     &surface );

          dfb_surface_lock_buffer( surface,
                                   CSBR_BACK, CSAID_CPU,
                                   CSAF_WRITE, &src_lock );

          dfb_surface_unlock_buffer( surface, &src_lock );
          dfb_surface_unref( surface );

          printf("iteration: %d\n", i);
     }

out:
     dfb->Release( dfb );

     return 0;
}
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to