Gui: Fix crash when trying to transform link object

This is a regression caused by PR 17564.

ViewProviderDragger has the member 'forwardedViewProvider' that is used
to handle the editing by the parent object. This means that inside
ViewProviderLink::startEditing 'transformDragger' can be null but this
isn't checked so that accessing the member causes a segmentation fault
or a failing assert in debug mode, respectively.

Solution:
Make sure that transformDragger is not null before accessing it.

This fixes 19542.
This commit is contained in:
wmayer
2025-02-15 01:12:31 +01:00
committed by Ladislav Michl
parent c21b330a98
commit 59717fc607

View File

@@ -2793,11 +2793,13 @@ ViewProvider *ViewProviderLink::startEditing(int mode) {
}
if (auto result = inherited::startEditing(mode)) {
transformDragger->addStartCallback(dragStartCallback, this);
transformDragger->addFinishCallback(dragFinishCallback, this);
transformDragger->addMotionCallback(dragMotionCallback, this);
if (transformDragger.get()) {
transformDragger->addStartCallback(dragStartCallback, this);
transformDragger->addFinishCallback(dragFinishCallback, this);
transformDragger->addMotionCallback(dragMotionCallback, this);
setDraggerPlacement(dragCtx->initialPlacement);
setDraggerPlacement(dragCtx->initialPlacement);
}
return result;
}