Skip to content

Commit f087f9c

Browse files
utkarshayachitkwrobot
authored andcommitted
Merge topic 'safer-unified-bindings-arg'
b4323fc unified-bindings: use GetObjectFromPointer
2 parents 39c6e38 + b4323fc commit f087f9c

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

ParaViewCore/ClientServerStream/vtkClientServerInterpreterPython.cxx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ static vtkObjectBase* NewInstanceCallback(void* ctx)
187187

188188
vtkObjectBase* obj = PyVTKObject_GetObject(instance);
189189
obj->Register(NULL);
190-
// The caller owns the new object, so kick it out of the object cache.
191-
vtkPythonUtil::RemoveObjectFromMap(instance);
192190

193191
return obj;
194192
}
@@ -363,7 +361,7 @@ static int CommandFunctionCallback(vtkClientServerInterpreter* /*interp*/,
363361
return 0;
364362
}
365363

366-
vtkSmartPyObject vtkObject(PyVTKObject_New(data->Object, NULL, ptr));
364+
vtkSmartPyObject vtkObject(vtkPythonUtil::GetObjectFromPointer(ptr));
367365
PyObject* methodObject = PyObject_GetAttrString(vtkObject, method);
368366

369367
const int argOffset = 2;
@@ -428,8 +426,7 @@ static int CommandFunctionCallback(vtkClientServerInterpreter* /*interp*/,
428426
vtkObjectBase* argObj;
429427
if (msg.GetArgument(0, msgArg, &argObj) && argObj)
430428
{
431-
PyObject* cls = vtkPythonUtil::FindNearestBaseClass(argObj);
432-
PyObject* obj = PyVTKObject_New(cls, NULL, argObj);
429+
PyObject* obj = vtkPythonUtil::GetObjectFromPointer(argObj);
433430
PyTuple_SET_ITEM(args.GetPointer(), pyArg, obj);
434431
}
435432
else
@@ -453,11 +450,6 @@ static int CommandFunctionCallback(vtkClientServerInterpreter* /*interp*/,
453450

454451
vtkSmartPyObject callResult(PyObject_CallObject(methodObject, args));
455452

456-
// Stop tracking the created Python object within VTK. Without this, the
457-
// vtkPython code tries to delete `ptr`, but we can't let that happen since
458-
// even this function doesn't own `ptr`.
459-
vtkPythonUtil::RemoveObjectFromMap(vtkObject);
460-
461453
if (!callResult)
462454
{
463455
vtkOStrStreamWrapper vtkmsg;

0 commit comments

Comments
 (0)