[Libreoffice-bugs] [Bug 114815] Crash in: take_gil on paste from clipboard in Windows

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Mon Jan 29 06:45:42 UTC 2018


https://bugs.documentfoundation.org/show_bug.cgi?id=114815

--- Comment #8 from Mike Kaganski <mikekaganski at hotmail.com> ---
In CreateInstance( const Reference< XComponentContext > & )
(pyuno/source/loader/pyuno_loader.cxx), there is a check that initializes
Python **and threads** when !Py_IsInitialized().

Can't it be that sometimes Python may be initialized somehow already, but miss
threads initialization? so that in this case, PyEval_InitThreads() isn't
called, global interpreter lock isn't created, and following attempt to use it
crashes?

The idea is to use another check to initialize threads:

    if( ! Py_IsInitialized() )
    {
        ...
        // initialize python
        Py_Initialize();
    }

    if( ! PyEval_ThreadsInitialized() )
    {
        PyEval_InitThreads();

        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);
    }

...

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20180129/468b1768/attachment-0001.html>


More information about the Libreoffice-bugs mailing list