This is a long-lasting bug that inhibits use of python scripting in kig. This was exposed since Boost 1.63 when an assertion was added related to a reference count that should never go down to zero.
Description
my collegue Franco Pasquarelli proposed the following patch
diff --git a/scripting/python_scripter.cc b/scripting/python_scripter.cc
index 62a7409b..ada48861 100644
- a/scripting/python_scripter.cc
+++ b/scripting/python_scripter.cc
@@ -527,13 +527,14 @@ ObjectImp* PythonScripter::calc( CompiledPythonScript& script, const Args& args
handle<> argstuph( PyTuple_New( args.size() ) ); for ( int i = 0; i < (int) objectvect.size(); ++i ) {
+ Py_XINCREF((objectvect.begin() +i)->ptr());
PyTuple_SetItem( argstuph.get(), i, (objectvect.begin() +i)->ptr() ); };
+
+
tuple argstup( argstuph ); handle<> reth( PyEval_CallObject( calcfunc.ptr(), argstup.ptr() ) );
- object resulto = calcfunc( argstup );
- handle<> reth( PyEval_CallObject( calcfunc.ptr(), args ) );
object resulto( reth ); extract<ObjectImp&> result( resulto );
@paolini Could you create a proper diff for review: https://phabricator.kde.org/differential/diff/create/? This will make it easier to review
I uploaded the result of a git diff in
https://phabricator.kde.org/differential/diff/72496/
but I don't know how to attach it to this task (sorry)
In fact this ptaskatch doesn't need to exist at all (there is already a bug report), just follow the instructions at https://community.kde.org/Infrastructure/Phabricator#Posting_a_Patch_using_the_website to create a review request.
Basically you need to go to https://phabricator.kde.org/differential/diff/72496/ and click the Continue button to finish submitting the patch.