Skip to content

Commit

Permalink
[Bugfix]Gui: detach field sensor of draggers and handle post-call of …
Browse files Browse the repository at this point in the history
…callbacks, fixes FreeCAD#9465
  • Loading branch information
0penBrain committed Jul 23, 2023
1 parent 2167fb6 commit 662adaf
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/Gui/SoFCCSysDragger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ TDragger::TDragger()

TDragger::~TDragger()
{

fieldSensor.setData(nullptr);
fieldSensor.detach();
}

void TDragger::buildFirstInstance()
Expand Down Expand Up @@ -216,9 +217,12 @@ void TDragger::fieldSensorCB(void *f, SoSensor *)
{
auto sudoThis = static_cast<TDragger *>(f);

SbMatrix matrix = sudoThis->getMotionMatrix(); // clazy:exclude=rule-of-two-soft
sudoThis->workFieldsIntoTransform(matrix);
sudoThis->setMotionMatrix(matrix);
if(!f)
return;

SbMatrix matrix = sudoThis->getMotionMatrix(); // clazy:exclude=rule-of-two-soft
sudoThis->workFieldsIntoTransform(matrix);
sudoThis->setMotionMatrix(matrix);
}

void TDragger::valueChangedCB(void *, SoDragger *d)
Expand Down Expand Up @@ -402,7 +406,8 @@ RDragger::RDragger()

RDragger::~RDragger()
{

fieldSensor.setData(nullptr);
fieldSensor.detach();
}

void RDragger::buildFirstInstance()
Expand Down Expand Up @@ -488,9 +493,12 @@ void RDragger::fieldSensorCB(void *f, SoSensor *)
{
auto sudoThis = static_cast<RDragger *>(f);

SbMatrix matrix = sudoThis->getMotionMatrix(); // clazy:exclude=rule-of-two-soft
sudoThis->workFieldsIntoTransform(matrix);
sudoThis->setMotionMatrix(matrix);
if(!f)
return;

SbMatrix matrix = sudoThis->getMotionMatrix(); // clazy:exclude=rule-of-two-soft
sudoThis->workFieldsIntoTransform(matrix);
sudoThis->setMotionMatrix(matrix);
}

void RDragger::valueChangedCB(void *, SoDragger *d)
Expand Down

0 comments on commit 662adaf

Please sign in to comment.