Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50243 - sandbox/guigl/libs/guigl/src
From: stipe_at_[hidden]
Date: 2008-12-11 15:43:12


Author: srajko
Date: 2008-12-11 15:43:12 EST (Thu, 11 Dec 2008)
New Revision: 50243
URL: http://svn.boost.org/trac/boost/changeset/50243

Log:
making sure window id-s are valid in glut callbacks - FLTK calls with invalid ids
Text files modified:
   sandbox/guigl/libs/guigl/src/window.cpp | 9 +++++++++
   1 files changed, 9 insertions(+), 0 deletions(-)

Modified: sandbox/guigl/libs/guigl/src/window.cpp
==============================================================================
--- sandbox/guigl/libs/guigl/src/window.cpp (original)
+++ sandbox/guigl/libs/guigl/src/window.cpp 2008-12-11 15:43:12 EST (Thu, 11 Dec 2008)
@@ -53,6 +53,7 @@
     
     void destroy_window(int id)
     {
+ m_windows.erase(id);
         glutDestroyWindow(id);
     }
 private:
@@ -147,6 +148,8 @@
 void glut::display()
 {
     int id = glutGetWindow();
+ if(window::impl::s_glut->m_windows.find(id)==window::impl::s_glut->m_windows.end())
+ return;
     window::impl::s_glut->m_windows[id]->display();
     glutSwapBuffers();
 }
@@ -154,18 +157,24 @@
 void glut::mouse(int button, int state, int x, int y)
 {
     int id = glutGetWindow();
+ if(window::impl::s_glut->m_windows.find(id)==window::impl::s_glut->m_windows.end())
+ return;
     window::impl::s_glut->m_windows[id]->mouse(button, state, x, y);
 }
 
 void glut::movement(int x, int y)
 {
     int id = glutGetWindow();
+ if(window::impl::s_glut->m_windows.find(id)==window::impl::s_glut->m_windows.end())
+ return;
     window::impl::s_glut->m_windows[id]->movement(x, y);
 }
 
 void glut::entry(int state)
 {
     int id = glutGetWindow();
+ if(window::impl::s_glut->m_windows.find(id)==window::impl::s_glut->m_windows.end())
+ return;
     window::impl::s_glut->m_windows[id]->entry_exit(state);
 }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk