[osg-users] DatabasePager::DatabaseThread is crashing when DatabasePager has been deleted

Hartwig Wiesmann hartwig.wiesmann at skywind.eu
Sat Mar 24 06:53:31 PDT 2018


I have the following scenario:

1) A scene is using a database pager to load data by a pseudo-loader via the network; the viewer runs single threaded, the database pager uses default parameters 
2) When the database pager is still loading data via the network the viewer is closed.
3) Because of the closing of the viewer the database pager's destructor is called but it seems to be that the database threads are still running (I put some output at the end of the database pager's destructor and inside database pager's database threads and the database threads are still producing output).
Looking at the database pager's destructor the threads are not finished but will stop only when their current task has finished, I think.
4) The database thread will crash at

DatabasePager::FindCompileableGLObjectsVisitor stateToCompile(_pager, _pager->getMarkerObject());

 inside DatabasePager::DatabaseThread::run().
5) The reason for the crash is that DatabaseThread uses a simple pointer to the database pager. But the database pager is gone and therefore the stored pointer ("_pager") became invalid!

Am I doing anything wrong or is this a bug in OSG?

I think that "_pager" should be at least an observer of the database pager pointer and not a bare pointer. Or the destructor of DatabasePager must invalidate all its references stored in DatabasePager::DatabaseThread.


Read this topic online here:

More information about the osg-users mailing list