diff --git a/Common/CreateFile.cpp b/Common/CreateFile.cpp
index 8576ac0275e91435562a9cd0a82dce8398fdf7e6..285af09ec8fe97c3b1350766c26b51c50a143776 100644
--- a/Common/CreateFile.cpp
+++ b/Common/CreateFile.cpp
@@ -152,6 +152,11 @@ static PixelBuffer *GetCompositePixelBuffer(GLenum format, GLenum type)
       (FlGui::instance()->getCurrentOpenglWindow()->getDrawContext());
     newg->show();
     openglWindow::setLastHandled(newg);
+    //waiting for the os to really make the window visible and to call the "draw" function
+    //on (some ?) linux if we do not wait here, the window is not ready
+    //and the picture cannot be generated
+    while(!newg->valid())
+      Fl::wait();
   }
 
   PixelBuffer *buffer;