Yes. I wonder whether the specification allows implementaion to return used handle identifier which was destroyed before, even if the identifier was a VGImage object having child images, and child images are not destroyed yet.
If the answer is ‘No’, inform me the proper pages on OpenVG specification document which can explain why the answer is no.
That’s a good question. My best bet is that it’s not valid.
Page 14 of the 1.0 spec says:
Handles to distinct objects must compare as unequal using the C == operator.
There is not much room for interpretation :(.
Now another interesting question arises: After deleting a parent, should vgGetParent still return the parents handle? And if so, is it a valid handle for other OpenVG calls or not?
A quick test with the reference implementation shows, that vgGetParent returns the old parent-handle. It causes errors when used as an argument for vgClearImage though.
That’s fine with the spec. Read up on vgDestroyImage (spec 1.0 page 107):
Following the call, the image handle is no longer valid in any context that shared it. If the image is currently in use as a rendering target, is the ancestor of another image (see vgChildImage), or is set as a paint pattern image on a VGPaint object, its definition remains available to those consumers as long as they remain valid, but the handle may no longer be used.
Btw, I found a bug related to this issue in my implementation as well (same as your example, except that I have to create an image instead of a paint). Looks like I have to delay the destruction of the handle and add a “deleted”-flag to my images.
I read page 14 of spec says “Handles to distinct objects must compare as unequal using C == operator”.
But I think that the term of “handle” above means only “alive handle”.
And the spec doesn’t mention what if the handles were destroyed aleady. Must they still be distinguishable even though they are dead and useless? That is ambiguous.