From 671d9015d768bee0d31d6e0aecb333c964ebea79 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 2 Nov 2009 06:37:48 +0000
Subject: [PATCH] pp

---
 Fltk/openglWindow.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp
index 843035d823..30102b2db3 100644
--- a/Fltk/openglWindow.cpp
+++ b/Fltk/openglWindow.cpp
@@ -107,8 +107,10 @@ void openglWindow::drawBorder()
 void openglWindow::draw()
 {
   // some drawing routines can create data (STL triangulations, etc.):
-  // make sure that we don't fire draw() while we are already drawing
-  // (e.g. du to an impromptu Fl::check())
+  // make sure that we don't fire draw() while we are already drawing,
+  // e.g. due to an impromptu Fl::check(). The same lock is also used in 
+  // processSelectionBuffer to guarantee that we don't mix GL_RENDER and
+  // GL_SELECT rendering passes.
   if(_lock) return;
   _lock = true;
 
@@ -517,9 +519,9 @@ bool openglWindow::processSelectionBuffer(int type, bool multipleSelection,
 
   size += 1000; // security
 
-  // some drawing routines can create data (STL triangulations, etc.):
-  // make sure that we don't fire redraw while we are already drawing
-  // (e.g. du to an impromptu Fl::check())
+  // same lock as in draw() to prevent firing up a GL_SELECT rendering pass
+  // while a GL_RENDER pass is happening (due to the asynchronus nature of
+  // Fl::check()s
   if(_lock) return false;
   _lock = true;
 
-- 
GitLab