Daz crash / access violation
A plugin I'm developing has started to crash Daz Studio (Windows 10 x64) with an access violation error, and I'm struggling to pin down the root cause. My plugin makes continuous calls to DzNode::setWSRot() on bones in a DzSkeleton. These calls originate in a separate thread, but are passed through Qt signal/receiver via QtBlockingQueuedConnection to the main application thread, which per my reading of the Qt docs tells me should mitigate any potential concurrency or timing issues due to the different originating thread.
The crash happens inconsistently -- sometimes shortly after initialization, and sometimes many minutes later. But it does always happen. The stacktrace is below -- well into the Daz core unfortunately :
DzERCLink::isKey()+144 bytes DzERCLink::getKeyOpValue()+45 bytes DZERCLink::apply()+262 bytes DZNumericProperty::applyControllers()+131 bytes DzFloatProperty::getValueInternal()+156 bytes DzFloatProperty::getValue()+229 bytes DzFigureFollowHelper::figureMorphActivated()+77 bytes DzFigureFollowHelper::qt_static_metacall()+152 bytes QtMetaObject::activate()+1340 bytes QtMetaObject::activate()+1340 bytes DzProperty::emitCurrentValueChanged()+97 bytes DzProperty::qt_static_metacall()+4580 bytes QtMetaObject::activate()+1340 bytes DzController::qt_static_metacall()+154 bytes QtMetaObject::activate()+1340 bytes DzProperty::emitCurrentValueChanged()+97 bytes DzFloatProperty::setKeyValue()+607 bytes DzFloatProperty::setValue()+425 bytes DzFloatProperty::setValue()+71 bytes DzNode::setLocalTransform()+491 bytes DzNode::setWSTransform()+740 bytes DzNode::setWSRot()+284 bytes MyCode::doStuff()+935 bytes
Any ideas or suggestions on how to pinpoint the cause of this? I've wondered if I'm passing in bad data into DzNode::setWSRot(), but inspecting the values I'm sending has shown sane quaternion values.
Thanks
Comments
Some further insight into this issue :
I've removed multithreading as a potential ingredient here, and am able to reproduce the issue when all of my code runs in the single main application thread.
I've observed that the crash only occurs when calling setWSRot() on Genesis3 lThighBend and rThighBend bones. The bend/twist double bone arrangement for thigh and forearm is new to G3F I believe, and I recall this same code running without issue on Genesis2 and earlier.
Are there any special considerations I need to be aware of when calling setWSRot() on the ThighBend/ForearmBend bones? The twist axis is disabled on these bones and the twist component passes through to the respective Twist bone. 99% of the time calling setWSRot() on these bones works without issue, but this is definitely triggering my crash in the remaining 1%.
Any thoughts or insight?
Thanks
Disregard this question, I found my issue. It was not related to anything in Daz, but rather a problem caused by some multithreaded code elsewhere in my plugin. Multithreaded programming in C++ is very unforgiving, makes me miss Java.