Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QOpenGLWidget crash on destructor call

QOpenGLWidget crash on destructor call

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 933 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TinTin82
    wrote on last edited by
    #1

    Hi,

    i have a instance of a class derivated from QOpenGLWidget. Every time the destructor is called the application crashes.

    QOpenGLWidget::~QOpenGLWidget()
    {
        makeCurrent(); // <- Here the Crash happens
    }
    

    If i go deeper into the callstack ist stopps at:

    QOpenGLWidget::~QOpenGLWidget()->
    void QOpenGLWidget::makeCurrent()->
    bool QOpenGLContext::makeCurrent(QSurface *surface)->
    QOpenGLContext *QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context)->
    localData()->
    T *&qThreadStorage_localData(QThreadStorageData &d, T **)->
    void **QThreadStorageData::get() const
    {
        QThreadData *data = QThreadData::current();
        if (!data) {
            qWarning("QThreadStorage::get: QThreadStorage can only be used with threads started with QThread");
            return 0;
        }
        QVector<void *> &tls = data->tls;
        if (tls.size() <= id) // <- here
    }
    

    Anyone a idea what happens here ??

    Best regards,
    TinTin

    1 Reply Last reply
    0
    • T Offline
      T Offline
      TinTin82
      wrote on last edited by TinTin82
      #2

      Okay, i have the Problem

      the "this" pointer of QOpenGLContextPrivate instance has been the NULL pointer.
      On Accessing QThreadStorageData::id the Crash happens.

      The This pointer was Zero because i used a static holder for all my instances. But i hold the QApplication in the stack.

      int main(int argc, char *argv[])
      {
      	int retVal;
      
      	// Make a singleton instance of QApplication
          int argc_=0;
      	QApplication app(argc_,(char **)NULL);
      	// Then allocate the Holder within all other QtWidgets but OsTimer and Application Scheduler
      	GLOBAL_HOLDER_INSTANCE = Holder::getInstance();
      ...
      

      And the holder was singleton:

      Holder::getInstance()
      {
           static Holder Instance;
           return &Instance;
      }
      

      So i deleted the QApplication bevor deleting the other instances....

      So it was not to solve within the Information i posted here.

      Best regards TinTin

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved