Do you have an observer attached to any of the definitions involved in the boolean subtract operation ?
And if so, does the callback try to call #attribute_dictionaries upon one of the arguments or some other reference your extension is keeping that might have “gone out of scope” (ie, become invalid) ?
There is a recently reported issue with some observers regarding attribute dictionaries that shouldn’t happen. I’m trying to find the issue report.
I’m guessing that if you wrapped your code in model.start_operation and model.commit_operation you’d not see this issue, as observers are suspended and queued while an operation is active.