From a2c768c7cdad2481468240229f5d7b85eaf6b499 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sat, 4 Jun 2011 17:55:12 +0200 Subject: [PATCH] Fix crash when display/screen number invalid getScreenResolution shouldn't be called before the safety check. Fixes commit ba7d8b8155731c95acf43f5e5a5a007cc6e96cdc --- src/Main/WindowBuilder.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Main/WindowBuilder.cxx b/src/Main/WindowBuilder.cxx index 2ca83cfc6..ceb23b461 100644 --- a/src/Main/WindowBuilder.cxx +++ b/src/Main/WindowBuilder.cxx @@ -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); + traits->readDISPLAY(); 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"; -- 2.39.5