From b439c08b7148c9d67fbadfa688e20e4887a4bde0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 14 Oct 2006 10:16:00 +0000 Subject: [PATCH] From Paul de Repentigny, fix for dvide by zero crash under windows when toggle full screen in ogviewer. From Robert Osfield, tweak to the fix to add comment describing the extra check, and addition of check against width, and change to ==0 rather than <= 0. --- src/osgProducer/ViewerEventHandler.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/osgProducer/ViewerEventHandler.cpp b/src/osgProducer/ViewerEventHandler.cpp index 5b86f1ee0..98d49acf9 100644 --- a/src/osgProducer/ViewerEventHandler.cpp +++ b/src/osgProducer/ViewerEventHandler.cpp @@ -208,6 +208,10 @@ void ViewerEventHandler::StatsAndHelpDrawCallback::operator()( const Producer::C int x,y; unsigned int width,height; camera.getProjectionRectangle(x,y,width,height); + + // don't redraw if the new window size is 0 width or height. + if (width==0 || height==0) return; + _viewport->setViewport(x,y,width,height); OsgSceneHandler* osh = _veh->getOsgCameraGroup()->getSceneHandlerList()[_cameraNumber].get(); @@ -1258,13 +1262,6 @@ bool ViewerEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio } -#ifdef COMPILE_COMPOSITE_EVENTHANDLER -void ViewerEventHandler::accept(osgGA::GUIEventHandlerVisitor& gehv) -{ - gehv.visit(*this); -} -#endif - void ViewerEventHandler::getUsage(osg::ApplicationUsage& usage) const { usage.addKeyboardMouseBinding("f","Toggle fullscreen");