Spreadsheet: in ViewProviderSheet do not add a second member to store the Python wrapper because the base class already has it

and it invalidates the wrapper in case the it is destroyed
This commit is contained in:
wmayer
2021-11-13 21:34:43 +01:00
parent 54688e7267
commit 43b3bfcb04
2 changed files with 4 additions and 7 deletions

View File

@@ -185,11 +185,10 @@ void ViewProviderSheet::updateData(const App::Property* prop)
PyObject *ViewProviderSheet::getPyObject()
{
if (PythonObject.is(Py::_None())){
// ref counter is set to 1
PythonObject = Py::Object(new ViewProviderSpreadsheetPy(this), true);
}
return Py::new_reference_to(PythonObject);
if (!pyViewObject)
pyViewObject = new ViewProviderSpreadsheetPy(this);
pyViewObject->IncRef();
return pyViewObject;
}
// Python feature -----------------------------------------------------------------------

View File

@@ -77,8 +77,6 @@ protected:
void updateData(const App::Property *prop) override;
private:
QPointer<SheetView> view;
Py::Object PythonObject;
};
typedef Gui::ViewProviderPythonFeatureT<ViewProviderSheet> ViewProviderSheetPython;