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!