Comment 14 for bug 940638

Revision history for this message
Bernd Kreuss (prof7bit) wrote :

Its happening during initialization of OpenGL

Inserting this into StelMainGraphicsView.cpp, Line 204

 qDebug() << "!!! locale before " << setlocale(LC_NUMERIC, NULL);
 glWidget = new StelQGLWidget(glContext, this);
 qDebug() << "!!! locale after" << setlocale(LC_NUMERIC, NULL);

will print the following to the console:

!!! locale before C
DRM version 1.10 too old to support HyperZ, disabling.
!!! locale after de_DE.UTF-8

This means initializing OpenGL on some (maybe buggy) Systems will cause
LC_NUMERIC being reset to the value of LC_ALL. Therefore I propose the
following patch:

=== modified file 'src/StelMainGraphicsView.cpp'
--- src/StelMainGraphicsView.cpp 2012-02-25 14:13:20 +0000
+++ src/StelMainGraphicsView.cpp 2012-04-19 20:32:06 +0000
@@ -212,6 +212,14 @@

  backItem = new QGraphicsWidget();
  backItem->setFocusPolicy(Qt::NoFocus);
+
+ // Workaround (see Bug #940638) Although we have already explicitly set
+ // LC_NUMERIC to "C" in main.cpp there seems to be a bug in OpenGL where
+ // it will silently reset LC_NUMERIC to the value of LC_ALL during OpenGL
+ // initialization. This has been observed on Ubuntu 11.10 under certain
+ // circumstances, so here we set it again just to be on the safe side.
+ setlocale(LC_NUMERIC, "C");
+ // End workaround
 }

 StelMainGraphicsView::~StelMainGraphicsView()

I have attached the patch as a file to this bug report.