Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-5729

getProcAddress() should return a function pointer

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 3.x
    • Fix Version/s: 5.0.0
    • Component/s: GUI: OpenGL
    • Labels:
      None
    • Commits:
      9702400e2d45c074922e488e01ab8ade82431b47

      Description

      The return type of QGLContext::getProcAddress() should be a function pointer and not a data pointer. The wrapped function glXGetProcAddress() has the correct prototype, but for some reason the QGLContext method deviates from the correct GLX API. According to the C and C++ standards, it is valid to cast between different function pointer types, as long as the actual call is made through a pointer with the original signature of the function pointed to. However, the standard explicitly does not make the same guarantee for the conversion from a function pointer to a non-function pointer and back.

      Strictly speaking, it should be a pointer to a function with C linkage:

      extern "C"

      { typedef void (*QGLProc)(); }

      ...
      QGLProc getProcAddress(const QString&);

      This is an API bug, and the invalid type conversion will cause compilers to complain with the right warning settings.

        Attachments

        For Gerrit Dashboard: QTBUG-5729
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            rodal Samuel Rødal
            Reporter:
            danielk Daniel Elstner
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes