02-20-2021, 11:37 AM
It was a long haul to track this down, but I'd like to report some success.
I moved all functions that manipulate art into the main file (now over 1,400 lines!). That didn't help. Adding or removing pushContext and popContext in the custom art update callback made no difference, either.
Here's what was happening. While evaluating a path to create a group of multiple paths, several Art objects contain partial duplicates of the original path. A loop essentially moves the path along an assembly line, where it's evaluated segment-by-segment. Art is assigned from one Art object to another (e.g., oldArt = newArt; then newArt created again). I don't know if this reassigning set up a problem situation, but I suspect it's possible.
Sometimes an art object is no longer needed and is disposed. All is well when the function is called from a tool or menu, but when called from a custom art callback I saw something like this:
someArt.artType(); // returns 110
someOtherArt.dispose();
someArt.artType(); // now returns 0
someArt.isEmpty(); // returns 0 -- some operations work, but others cause a crash
My solution was to store references to the junk art in a vector, then delete all junk at the end of the function.
I hope this is helpful to others.
I moved all functions that manipulate art into the main file (now over 1,400 lines!). That didn't help. Adding or removing pushContext and popContext in the custom art update callback made no difference, either.
Here's what was happening. While evaluating a path to create a group of multiple paths, several Art objects contain partial duplicates of the original path. A loop essentially moves the path along an assembly line, where it's evaluated segment-by-segment. Art is assigned from one Art object to another (e.g., oldArt = newArt; then newArt created again). I don't know if this reassigning set up a problem situation, but I suspect it's possible.
Sometimes an art object is no longer needed and is disposed. All is well when the function is called from a tool or menu, but when called from a custom art callback I saw something like this:
someArt.artType(); // returns 110
someOtherArt.dispose();
someArt.artType(); // now returns 0
someArt.isEmpty(); // returns 0 -- some operations work, but others cause a crash
My solution was to store references to the junk art in a vector, then delete all junk at the end of the function.
I hope this is helpful to others.