Core dump after setting image resource

Hi Folks

I’ve some problems when setting the Pt_ARG_IMAGEAREA_IMAGE resource at a PtImageArea.

In my project I use a PtImageArea to show some different pictures depending on a external database value. To do so I use a PtImageArea for output which is also the parent of the construction and furthermore I’ve attached some PtImageAreas as children for storing the PhImage_t information of different pictures.

The idea is to scan all the attached children, when the db value was changed and than get the _IMAGE resource from the fitting children to display it at the parent widget.

It works fine in PhAB! Every time I change my db value, PtGetResource delivers a pointer to the _IMAGE resource of the selected widget and the output widget displays the picture.

But when I run my application outside of PhAB, the application quits service after I chose a selected value for the second time. The PtGetReource call also delivers a pointer (the same one as in the first call) to the _IMAGE resource of the fitting children widget but than after the PtSetReource call the application runs into a core dump.

I’ve add a simplified example of what is called when the db value was changed.

Expl.:

[code]PtWidget_t *Child;

for ( Child = PtWidgetChildBack (pWidget); Child; Child = PtWidgetBrotherInFront (Child) )
{
int Rtc = 0;
PhImage_t *Image;

Rtc += PtGetResource ( Child, Pt_ARG_IMAGEAREA_IMAGE, &Image, 0 );

if ( Rtc != 0 ) continue;

switch (...)
{
...
case RTR_COMPMODE_EQUAL:
  if ( ... )
  {
    PtSetResource  ( Parent->WgtImageArea, Pt_ARG_IMAGEAREA_IMAGE, Image, 0 );
    
    // PtDamageWidget ( Parent->WgtImageArea ); // tried
  }
  break;
}

}[/code]

Some idea why this happens? Or is there a more detailed description necessary?

Thanks for your help!

When you run the app outside de builder, are you sure you are running the same executable? Maybe you are running the debug version from inside and the realese version from the outside. Check <your_traget>/o-g/your_app_g…

Try these as first aproach.

Juan Manuel

The code above is part of a custom widget library and I use it precompiled (as lib) in another project. So I’m relative sure PhAB uses the same binary as the executable.

Franz

You should debug your core dump file. You must run the “dumper” process if it isn’t running yet. After that, run your app. Then debbug your /var/dumps/app.core. Doing a backtrace (bt) you should realize what your program was trying to do when died.

Regards,
Juan Manuel