QOpenGLWidget crash on destructor call



  • 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



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.