Ensure global Mutex is initialized before Registry

A Registry instance may be accessed before the global mutex, e.g. here:

e77f50371c/src/osgText/Font.cpp (L49)

This leads to the Mutex being destroyed before the Registry is destroyed.

This causes a crash at exit, as described in #1048.

Fixes #1048.
This commit is contained in:
Gleb Mazovetskiy 2021-03-07 04:25:22 +00:00 committed by Robert Osfield
parent 5faae0e52e
commit 8b2e02b71d

View File

@ -50,7 +50,8 @@ namespace osgDB {
The RegisterReaderWriterProxy can be used to automatically
register at runtime a reader/writer with the Registry.
*/
class OSGDB_EXPORT Registry : public osg::Referenced
class OSGDB_EXPORT Registry : osg::depends_on<OpenThreads::Mutex*, osg::Referenced::getGlobalReferencedMutex>,
public osg::Referenced
{
public: