[PATCH] pyuno_loader::CreateInstance: delete the initial PyThreadSta...

Michael Stahl (via Code Review) gerrit at gerrit.libreoffice.org
Thu Apr 18 04:27:24 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3452

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/52/3452/1

pyuno_loader::CreateInstance: delete the initial PyThreadState

Don't see how it could be used again, it appears to be leaked
and causes the assertion in PyThreadState_Swap to fire.

Change-Id: Id6bbb4363928e4fdd8bda1905f6e1f9931dba74c
---
M pyuno/source/loader/pyuno_loader.cxx
1 file changed, 4 insertions(+), 0 deletions(-)



diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx
index 0db1b9b..718edc7 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -223,6 +223,10 @@
 
         PyThreadState *tstate = PyThreadState_Get();
         PyEval_ReleaseThread( tstate );
+        // This tstate is never used again, so delete it here.
+        // This prevents an assertion in PyThreadState_Swap on the
+        // PyThreadAttach below.
+        PyThreadState_Delete(tstate);
     }
 
     PyThreadAttach attach( PyInterpreterState_Head() );

-- 
To view, visit https://gerrit.libreoffice.org/3452
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6bbb4363928e4fdd8bda1905f6e1f9931dba74c
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Michael Stahl <mstahl at redhat.com>



More information about the LibreOffice mailing list