Fem: replace raw pointer with WeakPtrT to check if the object has been deleted, fix crash in destructor of TaskFemConstraintOnBoundary

This commit is contained in:
wmayer
2022-03-19 15:37:31 +01:00
parent a60754ea93
commit 90d546d1e7
2 changed files with 5 additions and 3 deletions

View File

@@ -25,9 +25,10 @@
#ifndef GUI_TASKVIEW_TaskFemConstraint_H
#define GUI_TASKVIEW_TaskFemConstraint_H
#include <Gui/TaskView/TaskView.h>
#include <Gui/DocumentObserver.h>
#include <Gui/Selection.h>
#include <Gui/TaskView/TaskDialog.h>
#include <Gui/TaskView/TaskView.h>
#include "ViewProviderFemConstraint.h"
@@ -69,7 +70,7 @@ protected:
protected:
QWidget* proxy;
QAction* deleteAction;
ViewProviderFemConstraint *ConstraintView;
Gui::WeakPtrT<ViewProviderFemConstraint> ConstraintView;
enum {seldir, selref, selloc, selnone} selectionMode;
private:

View File

@@ -39,7 +39,8 @@ TaskFemConstraintOnBoundary::TaskFemConstraintOnBoundary(ViewProviderFemConstrai
TaskFemConstraintOnBoundary::~TaskFemConstraintOnBoundary()
{
ConstraintView->highlightReferences(false);
if (!ConstraintView.expired())
ConstraintView->highlightReferences(false);
}
void TaskFemConstraintOnBoundary::_addToSelection(bool checked)