crash when initializing resource groups

Minor issues with the Ogre API that can be trivial to fix
Post Reply
Posts: 202
Joined: Sun Feb 25, 2007 1:45 am
Location: USA
x 6

crash when initializing resource groups

Post by uzik »

If you call

Code: Select all

before creating a render window ogre crashes.

If a resource group contains shader source code the resource manager tries to verify that the shader is of a supported type.
Since the render system has not set the capabilities yet the second statement in the code below retrieves an uninitialized pointer and tries to use it.

Code: Select all

bool GpuProgramManager::isSyntaxSupported(const String& syntaxCode) const
        // Use the current render system
        RenderSystem* rs = Root::getSingleton().getRenderSystem();

        // Get the supported syntax from RenderSystemCapabilities 
        return rs->getCapabilities()->isShaderProfileSupported(syntaxCode);
I suggest a couple of asserts or exceptions that check the pointers "rs" and "rs->getCapabilities()" for sanity.
If they are invalid it might suggest to the user that they must create a valid render window before initializing the resource groups.
---A dream doesn't become reality through magic; it takes sweat, determination and hard work.

User avatar
OGRE Team Member
OGRE Team Member
Posts: 4293
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 127

Re: crash when initializing resource groups

Post by spacegaier »

Sounds reasonable. Can you please either create a JIRA ticket and link to this thread or (even better) provide a pull-request for quick merging. Thanks!
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...

Post Reply