Skip to content

Commit 0fb8373

Browse files
committed
Solving the unload module segmentation fault error
1 parent ae55643 commit 0fb8373

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Source/PythonEngine.pas

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8295,7 +8295,7 @@ procedure TPythonType.Initialize;
82958295

82968296
procedure TPythonType.Finalize;
82978297
begin
8298-
Engine.Py_XDECREF(FCreateFunc);
8298+
Engine.Py_CLEAR(FCreateFunc);
82998299
FCreateFunc := nil;
83008300
inherited;
83018301
end;
@@ -8357,7 +8357,8 @@ procedure TPythonType.AddTypeVar;
83578357
FCreateFuncDef.ml_meth := GetOfObjectCallBack( TCallBack(meth), 2, DEFAULT_CALLBACK_TYPE);
83588358
FCreateFuncDef.ml_flags := METH_VARARGS;
83598359
FCreateFuncDef.ml_doc := PAnsiChar(FCreateFuncDoc);
8360-
FCreateFunc := Engine.PyCFunction_NewEx(@FCreateFuncDef, nil, nil)
8360+
FCreateFunc := Engine.PyCFunction_NewEx(@FCreateFuncDef, nil, nil);
8361+
Engine.Py_INCREF(FCreateFunc);
83618362
end;
83628363
Assert(Assigned(FCreateFunc));
83638364
end;

0 commit comments

Comments
 (0)