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

--- Comment #8 from Mike Kaganski <[email protected]> ---
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.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to