From 1fb53a637597f76bea86514b62ddfad34f60c889 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 18 Apr 2013 12:38:42 +0200 Subject: 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 Reviewed-on: https://gerrit.libreoffice.org/3452 Reviewed-by: David Ostrovsky Tested-by: David Ostrovsky --- pyuno/source/loader/pyuno_loader.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index 0db1b9b59023..718edc744b46 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -223,6 +223,10 @@ Reference< XInterface > CreateInstance( const Reference< XComponentContext > & c 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() ); -- cgit