PtSetResource() behaviour

Just a quickie, when I PtSetResource a string resource like Pt_ARG_TEXT_STRING I can use a dynamically allocated string, and free it straight away and everything is fine. However if I set the the resource Pt_ARG_TITLE of a PtTerminal in the same way, freeing the memory later causes a segfault, if I don’t free everything works fine but this is going to cause a memory leak (i’m guessing here).

So is it the case that some resources copy the data into themselves so the original data is no longer required, but some widgets use the actual data passed so that data can never be freed until the widget is destroyed?

If this is the case, how can I tell which resources have which behaviour?

Cheers

Garry

All PtSetResource() is enqueue the action - in some cases it will appear to happen right away, in others it may take a while. I am not sure what you are seeing is not an example of this behaviour. As far as I know, the data is always copied (when it gets around to it).

Rick…

I think I see, I did a workaround in my app which fixes the crashing but I’m doing similar things in loads of other places and it’s working fine, so I guess the data is copied pretty much right away in those resources.

Anyway it’s good to know the data is always copied and not used in place.

Cheers

Garry