Boost singleton and undefined reference

Posted by Ockonal on Stack Overflow See other posts from Stack Overflow or by Ockonal
Published on 2010-06-05T21:29:00Z Indexed on 2010/06/05 21:32 UTC
Read the original article Hit count: 204

Filed under:
|
|
|
|

Hello, I globally use singleton pattern in my project. To make it easier - boost::singleton. Current project uses Ogre3d library for rendering. Here is some class:

class GraphicSystem : public singleton<GraphicSystem>
{
    private:
        Ogre::RenderWindow *mWindow;

    public:
        Ogre::RenderWindow *getWindow() const { return mWindow; }
};

In GraphicSystem constructor I fill the mWindow value:

mWindow = mRoot->createRenderWindow(...);

I cheked it, everything makes normally. So, now I have to use handler for the window in input system (to get window handle).

Somewhere else in another class:

Ogre::RenderWindow *temp = GraphicSystem::get_mutable_instance().getWindow();
GraphicSystem::get_mutable_instance().getWindow()->getCustomAttribute("WINDOW", &mWindowHandle);

temp is 0x00, and there is segfault at last line (getting custon attribute). I can't understand, why does singleton returns undefined pointer for the window. All another singleton-based classes work well.

© Stack Overflow or respective owner

Related posts about c++

Related posts about boost