Fix crash when display/screen number invalid
getScreenResolution shouldn't be called before the safety check.
Fixes commit ba7d8b8155
This commit is contained in:
parent
c9bb9f6044
commit
a2c768c7cd
1 changed files with 5 additions and 5 deletions
|
@ -53,12 +53,8 @@ WindowBuilder::makeDefaultTraits(bool stencil)
|
|||
GraphicsContext::WindowingSystemInterface* wsi
|
||||
= osg::GraphicsContext::getWindowingSystemInterface();
|
||||
GraphicsContext::Traits* traits = new osg::GraphicsContext::Traits;
|
||||
|
||||
traits->readDISPLAY();
|
||||
|
||||
unsigned screenwidth = 0;
|
||||
unsigned screenheight = 0;
|
||||
wsi->getScreenResolution(*traits, screenwidth, screenheight);
|
||||
|
||||
if (traits->displayNum < 0)
|
||||
traits->displayNum = 0;
|
||||
if (traits->screenNum < 0)
|
||||
|
@ -76,6 +72,10 @@ WindowBuilder::makeDefaultTraits(bool stencil)
|
|||
if (stencil)
|
||||
traits->stencil = 8;
|
||||
|
||||
unsigned screenwidth = 0;
|
||||
unsigned screenheight = 0;
|
||||
wsi->getScreenResolution(*traits, screenwidth, screenheight);
|
||||
|
||||
traits->doubleBuffer = true;
|
||||
traits->mipMapGeneration = true;
|
||||
traits->windowName = "FlightGear";
|
||||
|
|
Loading…
Reference in a new issue