Results 1 to 2 of 2

Thread: QOpenGLVertexArrayObject crash if QGLWidget not visible on close action

  1. #1
    Join Date
    Dec 2011
    Posts
    60
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QOpenGLVertexArrayObject crash if QGLWidget not visible on close action

    I have a Qt 5.2.1 program that uses QOpenGLVertexArrayObjects and creates more than one QGLWidget, each placed inside of a QStackedWidget. Thus, only one QGLWidget is visible at any one time.

    The issue is -- if I close the program and the QGLWidget that uses a QOpenGLVertexArrayObject ISN'T currently visible, it crashes with the message:

    Warning: QOpenGLVertexArrayObject::~QOpenGLVertexArrayObjec t() failed to make VAO's context current (opengl/qopenglvertexarrayobject.cpp:370, virtual QOpenGLVertexArrayObject::~QOpenGLVertexArrayObjec t())
    Looking through the source code, the destructor of QOpenGLVertexArrayObject contains the following code:

    Qt Code:
    1. /*!
    2.   Destroys the QOpenGLVertexArrayObject and the underlying OpenGL resource.
    3. */
    4. QOpenGLVertexArrayObject::~QOpenGLVertexArrayObject()
    5. {
    6. QOpenGLContext* ctx = QOpenGLContext::currentContext();
    7.  
    8. Q_D(QOpenGLVertexArrayObject);
    9. QOpenGLContext *oldContext = 0;
    10. if (d->context && ctx && d->context != ctx) {
    11. oldContext = ctx;
    12. if (d->context->makeCurrent(oldContext->surface())) {
    13. ctx = d->context;
    14. } else {
    15. qWarning("QOpenGLVertexArrayObject::~QOpenGLVertexArrayObject() failed to make VAO's context current");
    16. ctx = 0;
    17. }
    18. }
    19.  
    20. if (ctx)
    21. destroy();
    22.  
    23. if (oldContext) {
    24. if (!oldContext->makeCurrent(oldContext->surface()))
    25. qWarning("QOpenGLVertexArrayObject::~QOpenGLVertexArrayObject() failed to restore current context");
    26. }
    27. }
    To copy to clipboard, switch view to plain text mode 

    - Is it possible to use QOpenGLVertexArrayObjects in a QGLWidget that's not currently visible and close the program successfully?

    - Is this a bug?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QOpenGLVertexArrayObject crash if QGLWidget not visible on close action

    The warning issued is not a crash. Where does it crash? Have you looked at the backtrace?

Similar Threads

  1. QGLWidget + QOpenGLVertexArrayObject = no output
    By alketi in forum Qt Programming
    Replies: 0
    Last Post: 17th April 2015, 20:05
  2. Crash of a simple example when I close a window
    By 8Observer8 in forum Newbie
    Replies: 2
    Last Post: 6th December 2014, 16:55
  3. dock title bar crash on close
    By Alundra in forum Qt Programming
    Replies: 6
    Last Post: 26th May 2014, 21:51
  4. Replies: 1
    Last Post: 18th July 2012, 15:33
  5. QGLWidget is not visible on linux and Mac OS X
    By sanjayshelke in forum Qt Programming
    Replies: 6
    Last Post: 4th March 2008, 07:18

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.