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. QOpenGLFunctions_3_3_Core Incorrectly Assumes it Has Been Initialized
Qt 6.11 is out! See what's new in the release blog

QOpenGLFunctions_3_3_Core Incorrectly Assumes it Has Been Initialized

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 2.3k Views 3 Watching
  • 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.
  • JMO_GSJ Offline
    JMO_GSJ Offline
    JMO_GS
    wrote on last edited by
    #1

    I've got a Widget derived from QOpenGLWidget and QOpenGLFunctions_3_3_Core

     class MyWidget : public QOpenGLWidget, 
                         protected QOpenGLFunctions_3_3_Core
    {
        Q_OBJECT
    

    Sometimes my application never shows it. Consequently, my initializeGL override is never called and therefore I never call QOpenGLFunctions_3_3_Core::InitializeOpenGL. So QOpenGLFunctions_3_3_Core never initializes its backend pointers.

    That would be fine, but the problem is that when QOpenGLFunctions_3_3_Core is destroyed, it accesses these pointers as if they HAD been initialized

    QOpenGLFunctions_3_3_Core::~QOpenGLFunctions_3_3_Core()
    {
        if (d_1_0_Core)
            d_1_0_Core->refs.deref();
        Q_ASSERT(d_1_0_Core->refs.load());  // BAD!!!  BAD!!!! CRASH!!!
    

    So whenever I run a DEBUG build, my app crashes on shutdown.. d_1_0_Core was never initialized. The ASSERT assumes it is valid --> Crash. Even though the line just above was checking for NULL.

    I'm assuming this is a Qt bug, right Is this correct? Is it something I should report? Or have I failed to follow some protocol?

    (I realize I can, if necessary, cause Paint to be called. I don't want to. I shouldn't have to).

    Appreciate any responses

    -Joe

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Which version of Qt are you using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      JMO_GSJ 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Which version of Qt are you using ?

        JMO_GSJ Offline
        JMO_GSJ Offline
        JMO_GS
        wrote on last edited by
        #3

        @SGaist Hi, Thanks for answering. Currently I am using Qt 5.7

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          This has already been fixed in the dev branch

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • JMO_GSJ Offline
            JMO_GSJ Offline
            JMO_GS
            wrote on last edited by
            #5

            Excellent. Fortunately this only affects debug builds and only on shutdown so I guess I can wait for the next release. Thanks for the info

            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