Gui: fix crash with the move to the new-style of class SelectionFilterPy
When setting the selection filter below and hovering over an object causes a segmentation fault:
filter = Gui.Selection.Filter('SELECT Part::Feature')
Gui.Selection.addSelectionGate(filter)
This commit is contained in:
@@ -2303,7 +2303,7 @@ PyObject *SelectionSingleton::sAddSelectionGate(PyObject * /*self*/, PyObject *a
|
||||
if (PyArg_ParseTuple(args, "O!|i",SelectionFilterPy::type_object(),&filterPy,resolve)) {
|
||||
PY_TRY {
|
||||
Selection().addSelectionGate(new SelectionFilterGatePython(
|
||||
static_cast<SelectionFilterPy*>(filterPy)), toEnum(resolve));
|
||||
SelectionFilterPy::cast(filterPy)), toEnum(resolve));
|
||||
Py_Return;
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
@@ -45,6 +45,10 @@ public:
|
||||
|
||||
public:
|
||||
static void init_type(); // announce properties and methods
|
||||
static SelectionFilterPy* cast(PyObject* py) {
|
||||
using SelectionFilterClass = Py::PythonClassObject<SelectionFilterPy>;
|
||||
return SelectionFilterClass(py).getCxxObject();
|
||||
}
|
||||
|
||||
SelectionFilterPy(Py::PythonClassInstance* self, Py::Tuple& args, Py::Dict& kdws);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user