title: Qt App causes Segmentation Fault upon GLWidget.show();
body: <p>When I step through the debugger, I get the following pop-up message:</p>
  
  <pre><code>The inferior stopped because it received a signal from the Operating System.
  
  Signal name : 
  SIGSEGV
  Signal meaning : 
  Segmentation fault
  </code></pre>
  
  <p>Which is dependent (I think) on these lines of code:</p>
  
  <pre><code>#ifndef Q_WS_WINCE
      inline void show() { setVisible(true); }
  #else
      void show();
  #endif
      inline void hide() { setVisible(false); }
      inline QT_MOC_COMPAT void setShown(bool shown) { setVisible(shown); }
  </code></pre>
  
  <p>As far as I know, <code>Q_WS_WINCE</code> is NOT defined, although I haven't been able to find the definition behind it via Google; <a href="http://doc.trolltech.com/4.3/qtglobal.html#Q_WS_WIN" rel="nofollow">this</a> is the closest I've been able to find, although it lacks a <code>CE</code> definition. </p>
  
  <p>According to my debugger, this is what is being called, as the arrow follows <code>#ifndef Q_WS_WINCE</code>, at the call of the <code>inline void show() { setVisible(true); }</code> function.</p>
  
  <p>I am at a loss as to how this could be happening; what is happening here? I'm using Ubuntu 11.10, along with Qt Creator as my IDE. I should also note that this JUST started happening a few minutes ago; I was able to step through most of my code before without any issues.</p>
  
  <p><strong>GLWidget Header File</strong></p>
  
  <pre><code>#pragma once
  
  #include &lt;QGLWidget&gt;
  #include &lt;QInputEvent&gt;
  #include "Cube.h"
  
  class GLWidget : public QGLWidget
  {
      Q_OBJECT
  
  public:
      explicit GLWidget( QWidget *parent = 0 );
  
      ~GLWidget( void );
  
      QSize minimumSizeHint( void ) const;
  
      QSize sizeHint( void ) const;
  
  public slots:
      void SetXRotation( int angle );
  
      void SetYRotation( int angle );
  
      void SetZRotation( int angle );
  
  signals:
      void xRotationChanged( int angle );
  
      void yRotationChanged( int angle );
  
      void zRotationChanged( int angle );
  
  protected:
      void initializeGL( void );
  
      void paintGL( void );
  
      void resizeGL( int width, int height );
  
      void mousePressEvent( QMouseEvent *event );
  
      void mouseMoveEvent( QMouseEvent *event );
  
  private:
      Cube *mCube;
  
      int mXRot;
  
      int mYRot;
  
      int mZRot;
  
      QPoint mLastPos;
  
      QColor mQtGreen;
  
      QColor mQtPurple;
  
  };
  </code></pre>
  
  <p><strong>GLWidget Source File</strong></p>
  
  <pre><code>#include &lt;GL/freeglut.h&gt;
  
  #include &lt;QtGui&gt;
  #include &lt;QtOpenGL&gt;
  
  #include &lt;qmath.h&gt;
  #include &lt;QMatrix4x4&gt;
  
  #include "GLWidget.h"
  
  #ifndef GL_MULTISAMPLE
  #define GL_MULTISAMPLE 0x809D
  #endif
  
  static void qNormalizeAngle( int &amp;angle )
  {
      const int ANGLE_MULTIPLIER = 360 * 16;
  
      while( angle &lt; 0 )
          angle += ANGLE_MULTIPLIER;
      while ( angle &gt; ANGLE_MULTIPLIER )
          angle -= ANGLE_MULTIPLIER;
  }
  
  GLWidget::GLWidget( QWidget *parent ) :
      QGLWidget( parent ),
      mXRot( 0 ),
      mYRot( 0 ),
      mZRot( 0 )
  {    
  }
  
  GLWidget::~GLWidget( void )
  {
      delete mCube;
  }
  
  void GLWidget::initializeGL( void )
  {
      mQtGreen = QColor::fromCmyk( 0.40, 0.0, 1.0, 0.0 );
      mQtPurple = QColor::fromCmyk( 0.39, 0.39, 0.0, 0.0 );
  
      //glutInitDisplayMode( GLUT_RGBA | GLUT_DEPTH );
  
      qglClearColor( mQtPurple );
  
      mCube = new Cube( this );
      mCube-&gt;Init();
      mCube-&gt;SetColor( mQtGreen.dark() );
  
      glEnable( GL_DEPTH_TEST );
      glEnable( GL_CULL_FACE );
      glShadeModel( GL_SMOOTH );
      glEnable( GL_LIGHTING );
      glEnable( GL_LIGHT0 );
      glEnable( GL_MULTISAMPLE );
      static GLfloat lightPosition[4] = { 0.5, 5.0, 7.0, 1.0 };
      glLightfv( GL_LIGHT0, GL_POSITION, lightPosition );
  }
  
  QSize GLWidget::minimumSizeHint( void ) const
  {
      return QSize( 50, 50 );
  }
  
  void GLWidget::mouseMoveEvent( QMouseEvent *event )
  {
      mLastPos = event-&gt;pos();
  }
  
  void GLWidget::mousePressEvent( QMouseEvent *event )
  {
      static const int ANGLE_ADDIFIER = 8;
  
      int dx = event-&gt;x() - mLastPos.x();
      int dy = event-&gt;y() - mLastPos.y();
  
      if ( event-&gt;buttons() &amp; Qt::LeftButton )
      {
          SetXRotation( ( mXRot + ANGLE_ADDIFIER ) * dy );
          SetYRotation( ( mYRot + ANGLE_ADDIFIER ) * dx );
  
          qDebug() &lt;&lt; "You pressed the left mouse button!" &lt;&lt; '\n';
      }
      else if ( event-&gt;buttons() &amp; Qt::RightButton )
      {
          SetXRotation( ( mXRot + ANGLE_ADDIFIER ) * dy );
          SetZRotation( ( mZRot + ANGLE_ADDIFIER ) * dx );
  
          qDebug() &lt;&lt; "You pressed the right mouse button!" &lt;&lt; '\n';
      }
  
      mLastPos = event-&gt;pos();
  }
  
  void GLWidget::paintGL( void )
  {
      static const GLfloat ANGLE_DIVISOR = 16.0;
  
      glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
      glLoadIdentity();
      glTranslatef( 0.0, 0.0, -10.0 );
  
      glRotatef( mXRot / ANGLE_DIVISOR, 1.0, 0.0, 0.0 );
      glRotatef( mYRot / ANGLE_DIVISOR, 0.0, 1.0, 0.0 );
      glRotatef( mZRot / ANGLE_DIVISOR, 0.0, 0.0, 1.0 );
  
      mCube-&gt;Draw();
  }
  
  void GLWidget::resizeGL( int width, int height )
  {
      int side = qMin( width, height );
  
      //glutInitWindowPosition( 0, 0 );
      //glutInitWindowSize( width, height );
  
      glViewport( ( width - side ) / VIEWPORT_DIVISOR, ( height - side ) / VIEWPORT_DIVISOR, side, side );
      glMatrixMode( GL_PROJECTION );
      glLoadIdentity();
  
  #ifdef QT_OPENGL_ES_1
      glOrthof( -0.5, +0.5, -0.5, +0.5, 4.0, 15.0 );
  #else
      glOrtho( -0.5, +0.5, -0.5, +0.5, 4.0, 15.0 );
  #endif*/
  
      glMatrixMode( GL_MODELVIEW );
  }
  
  void GLWidget::SetXRotation( int angle )
  {
      qNormalizeAngle( angle );
  
      if ( angle != mYRot )
      {
          mYRot = angle;
          emit yRotationChanged( angle );
          updateGL();
      }
  }
  
  void GLWidget::SetYRotation( int angle )
  {
      qNormalizeAngle( angle );
  
      if ( angle != mXRot )
      {
          mXRot = angle;
          emit xRotationChanged( angle );
          updateGL();
      }
  }
  
  void GLWidget::SetZRotation( int angle )
  {
      qNormalizeAngle( angle );
  
      if ( angle != mZRot )
      {
          mZRot = angle;
          emit zRotationChanged( angle );
          updateGL();
      }
  }
  
  QSize GLWidget::sizeHint() const
  {
      return QSize( 400, 400 );
  }
  </code></pre>