Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: [Solved] segfault on unloadPlugins  (Read 2944 times)

Ice

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 21
    • View Profile
[Solved] segfault on unloadPlugins
« on: January 03, 2008, 05:23:33 AM »

I'm using Ogre 1.4.3 and Plugin_TheoraVideoSystem (WindowsXP, mingw). Videoplugin works great,but my application crashes with segfault on exit. There is gdb report:
Code: [Select]
#0 00000000 ??() (??:??)

#1 65389F19 Ogre::Root::unloadPlugins(this=0x374bc80) (E:/OgreCVS/ogrenew/OgreMain/src/OgreRoot.cpp:835)

#2 65386F93 Ogre::Root::~Root(this=0x374bc80) (E:/OgreCVS/ogrenew/OgreMain/src/OgreRoot.cpp:276)

#3 00401D7C GameManager::~GameManager(this=0x3747e60) (D:/MyApp/src/GameManager.cpp:56)

#4 0040F4E0 WinMain(hInst=0x400000, strCmdLine=0x241efc "") (D:/MyApp/src/main.cpp:28)

#5 0042041A main() (C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/iostream:77)

and part of Ogre.log:

Code: [Select]
...
17:12:51: Parsing script Shadows.overlay
17:12:51: Finished parsing scripts for resource group General
17:12:51: Parsing scripts for resource group Internal
17:12:51: Finished parsing scripts for resource group Internal
17:12:51: Creating viewport on target 'Test', rendering from camera 'IntroCamera', relative dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0
17:12:51: Viewport for camera 'IntroCamera', actual dimensions L: 0 T: 0 W: 1024 H: 768
17:12:51: Loading library FMOD_MOD
17:12:52: Vorbis Headers: 3 Theora Headers : 3
17:12:52: Texture: Europe.ogg: Loading 1 faces(PF_B8G8R8,352x240x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,352x240x1.
17:12:58: Unloading library FMOD_MOD
17:12:58: Unregistering ResourceManager for type BspLevel
17:12:58: *-*-* OGRE Shutdown
17:12:58: Unregistering ResourceManager for type Compositor
17:12:58: Unregistering ResourceManager for type Font
17:12:58: Unregistering ResourceManager for type Skeleton
17:12:58: Unregistering ResourceManager for type Mesh
17:12:58: Unregistering ResourceManager for type HighLevelGpuProgram

It seems that there is something wrong with my Plugin_TheoraVideoSystem.dll. What can cause this segfault? Could anyone upload debug and release version of this dll ?
« Last Edit: January 27, 2008, 10:48:52 AM by Ice »
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Re: segfault on unloadPlugins
« Reply #1 on: January 03, 2008, 06:04:04 AM »

I couldn't say why it is segfaulting, likely you are still holding on to a movie reference. Are you using gdb on windows or linux? If on windows, I would suggest using VC8 Express, since it is easier to debug with that on windows.
Logged

Ice

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 21
    • View Profile
Re: segfault on unloadPlugins
« Reply #2 on: January 04, 2008, 03:04:51 AM »

Thx for fast reply  :)
Yes, I'm using gdb on windows (codeblocks + mingw + gdb).
I verified your suggestion by closing application right after initialisation (i.e. without using videoplugin)
Code: [Select]
void GameManager::startGame( GameState *gameState ) {
    mRoot = new Root();

    mIntroState = IntroState::getSingletonPtr();
    mMainMenuState  = MainMenuState::getSingletonPtr();
    mPlayState = PlayState::getSingletonPtr();

    mSoundManagerEx = new SoundManagerEx();
    mSoundManagerEx->Initialize();

    // Setup input
    mInputMgr = InputManager::getSingletonPtr();
    mInputMgr->initialise( mRenderWindow );
    mInputMgr->addKeyListener( this, "GameManager" );
    mInputMgr->addMouseListener( this, "GameManager" );

    // SHUTDOWN
bShutdown = true;

    // Main while-loop
    while( !bShutdown ) {
...
}
}

GameManager::~GameManager( void ) {
    // Clean up all the states
    while( !mStates.empty() ) {
        mStates.back()->exit();
        mStates.pop_back();
    }

    if( mInputMgr ) {
        delete mInputMgr;
        mInputMgr = 0;
    }

    if( mIntroState ) {
        delete mIntroState;
        mIntroState = 0;
    }

    if( mMainMenuState ) {
        delete mMainMenuState;
        mMainMenuState  = 0;
    }

    if( mPlayState ) {
        delete mPlayState;
        mPlayState = 0;
    }

    if( mRoot ) {
        delete mRoot;
        mRoot = 0;
    }
}
It makes no difference, still segfaulting.

I also noticed that this occurs only with specific Plugin_TheoraVideoSystem.dll. I have old "release" dll, it works ok - no segfaulting. But the problem is that I need "debug" dll  :)
« Last Edit: January 04, 2008, 03:36:51 AM by Ice »
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Re: segfault on unloadPlugins
« Reply #3 on: January 04, 2008, 06:33:12 AM »

It is probably related to STL usage in debug mode. I've only seen troubles when using multiple libs under MinGW + Windows that make use of STL. Though, the callstack you posted seems incomplete in that it doesn't list any methods inside the plugin. I would guess that maybe you are mixing debug/release libs/dlss possibly?
Logged

Ice

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 21
    • View Profile
Re: segfault on unloadPlugins
« Reply #4 on: January 05, 2008, 02:18:57 AM »

First I tried to compile all stuff (ogg, vorbis, old theora, videoplugin) using MSVS scripts with CodeBlocks. So I compiled all this libraries in 2 versions - debug and release. Then I tried to compile it under msys using  ./configure+make+make install (the only way to compile libtheora-1.0beta2 with mingw). I suppose that in second case only release version of libs is compiled. But it doesn't matter because my app crashes even in release mode  :)
« Last Edit: January 05, 2008, 07:48:02 AM by Ice »
Logged

Ice

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 21
    • View Profile
Re: segfault on unloadPlugins
« Reply #5 on: January 17, 2008, 01:18:52 AM »

I just wonder if anyone can send me "release" and "debug" dlls compiled with mingw + Ogre 1.4.5  ::)
Logged

Ice

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 21
    • View Profile
Re: segfault on unloadPlugins
« Reply #6 on: January 27, 2008, 10:48:19 AM »

Ok, the problem is solved now ;D
I just updated Ogre (to 1.4.6), ptypes (to 2.1.1), ogg (to 1.1.3), vorbis (to 1.2.0) and theora (to 1.0beta2). And then recompiled TheoraVideo from CVS. It works now.
Thx for help  :)
Logged

czaoth

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
    • View Profile
Re: [Solved] segfault on unloadPlugins
« Reply #7 on: February 27, 2008, 01:12:48 AM »

cegui o.5 can supported?
I compiled error.
CEGUIStaticImage.h not found.
Logged

Ice

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 21
    • View Profile
Re: [Solved] segfault on unloadPlugins
« Reply #8 on: March 15, 2008, 02:02:28 AM »

yes, it is supported. but CVS should be updated with patch, which i sent to pjcast
Logged