OGRECave / ogre-audiovideo

plugins for theora video playback and openAL audio
https://ogrecave.github.io/ogre-audiovideo/
BSD 3-Clause "New" or "Revised" License
14 stars 11 forks source link

Check that SceneManager actually exists before cleaning dangling sounds #17

Closed sercero closed 3 years ago

sercero commented 3 years ago

This fix is for #15, I thought that using mSoundManager->setSceneManager(nullptr); fixed the problem but it still shows when using the debugger.

So I made this change that is not perfect because it is calling getName() on a SceneManager that might not exist but it works even if the SceneManager does not exist.

With this change it is not even needed to use the setSceneManager(nullptr) workaround.

paroj commented 3 years ago

I cannot reproduce the crash neither with boost threads nor with the non-threaded version. Maybe this was only introduced by the std thread port?

sercero commented 3 years ago

I cannot reproduce the crash neither with boost threads nor with the non-threaded version. Maybe this was only introduced by the std thread port?

This happens with the current master branch.

You have to do something like this to reproduce the issue:

    mSceneMgr->clearScene();
    mRoot->destroySceneManager(mSceneMgr);

    // mSoundManager->setSceneManager(nullptr);

    //Remove ourself as a Window listener
    Ogre::WindowEventUtilities::removeWindowEventListener(mWindow, this);
    windowClosed(mWindow);
    mRoot->shutdown();

    delete mRoot;

The issue is that is it possible to destroy the SceneManager that OgreOggSound is using before terminating the plugin.

paroj commented 3 years ago

does 346407fd3eb8ef3d194a364e989432ea18cd82ee also work for you?

sercero commented 3 years ago

Hello @paroj, yes that changed fixed it.

Thanks.

paroj commented 3 years ago

replaced by #18