App: move member DocumentPythonObject to DocumentP
This commit is contained in:
@@ -164,6 +164,8 @@ struct DocumentP
|
||||
long lastObjectId;
|
||||
DocumentObject* activeObject;
|
||||
Transaction *activeUndoTransaction;
|
||||
// pointer to the python class
|
||||
Py::Object DocumentPythonObject;
|
||||
int iTransactionMode;
|
||||
bool rollback;
|
||||
bool undoing; ///< document in the middle of undo or redo
|
||||
@@ -1527,8 +1529,8 @@ Document::Document(const char *name)
|
||||
// So, we must increment only if the interpreter gets a reference.
|
||||
// Remark: We force the document Python object to own the DocumentPy instance, thus we don't
|
||||
// have to care about ref counting any more.
|
||||
DocumentPythonObject = Py::Object(new DocumentPy(this), true);
|
||||
d = new DocumentP;
|
||||
d->DocumentPythonObject = Py::Object(new DocumentPy(this), true);
|
||||
|
||||
#ifdef FC_LOGUPDATECHAIN
|
||||
Console().Log("+App::Document: %p\n",this);
|
||||
@@ -1650,7 +1652,7 @@ Document::~Document()
|
||||
// But we must still invalidate the Python object because it doesn't need to be
|
||||
// destructed right now because the interpreter can own several references to it.
|
||||
Base::PyGILStateLocker lock;
|
||||
Base::PyObjectBase* doc = (Base::PyObjectBase*)DocumentPythonObject.ptr();
|
||||
Base::PyObjectBase* doc = static_cast<Base::PyObjectBase*>(d->DocumentPythonObject.ptr());
|
||||
// Call before decrementing the reference counter, otherwise a heap error can occur
|
||||
doc->setInvalid();
|
||||
|
||||
@@ -4651,9 +4653,9 @@ int Document::countObjectsOfType(const Base::Type& typeId) const
|
||||
return ct;
|
||||
}
|
||||
|
||||
PyObject * Document::getPyObject(void)
|
||||
PyObject * Document::getPyObject()
|
||||
{
|
||||
return Py::new_reference_to(DocumentPythonObject);
|
||||
return Py::new_reference_to(d->DocumentPythonObject);
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> Document::getRootObjects() const
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
#ifndef APP_DOCUMENT_H
|
||||
#define APP_DOCUMENT_H
|
||||
|
||||
#include <Base/Type.h>
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
#include "PropertyContainer.h"
|
||||
#include "PropertyLinks.h"
|
||||
#include "PropertyStandard.h"
|
||||
@@ -565,8 +562,6 @@ private:
|
||||
std::list<Transaction*> mRedoTransactions;
|
||||
std::map<int,Transaction*> mRedoMap;
|
||||
|
||||
// pointer to the python class
|
||||
Py::Object DocumentPythonObject;
|
||||
struct DocumentP* d;
|
||||
|
||||
std::string oldLabel;
|
||||
|
||||
Reference in New Issue
Block a user