Go to file
Laszlo Agocs 52781f2a7d Make versioned OpenGL functions working with the subclass pattern
QOpenGLFunctions allows both deriving from it and getting an instance
via QOpenGLContext::functions().

Unsurprisingly a large number of users attempt to use the versioned
function wrappers in the same way. Unfortunately this approach was
not that well supported.

Besides some potential base class exporting issues the real blocker for
QOpenGLWidget - or any versionfunction subclass whose associated context
changes during its lifetime - is that the functions instances could
only be initialized once. Unlike instances retrieved via
QOpenGLContext::versionFunctions(), instances created "manually" were not
deinitialized upon the destruction of the associated context because
context did not know about them.

A pattern like

  initializeOpenGLFunctions();
  delete context;
  create new context and make it current
  initializeOpenGLFunctions();

is working fine in QOpenGLFunctions-derived classes but not with the
versioned ones.

To overcome this, start registering such instances to the context too.
QOpenGLContext::destroy() can then reset the internal state so a
subsequent initializeOpenGLFunctions() will reinitialize properly instead
of bailing out mistakenly thinking that everything is ready to use.

Task-number: QTBUG-45199
Change-Id: Ia1420bcccb33c51508698b7a1b036c7544a66e74
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2015-03-27 16:36:34 +00:00
bin Fixed license headers 2015-02-17 18:46:09 +00:00
config.tests Introduce icu_dependency.pri 2015-03-20 18:12:04 +00:00
dist Replace old qt-project.org wiki with wiki.qt.io 2015-02-27 09:27:13 +00:00
doc Doc: Update URLs 2015-03-25 10:33:37 +00:00
examples Add OpenGL 4.5 to contextinfo example 2015-03-20 14:06:22 +00:00
lib Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
mkspecs fix quoting problems in ios main() renamer 2015-03-27 13:29:59 +00:00
qmake add DISTFILES support for Visual Studio projects 2015-03-27 13:38:15 +00:00
src Make versioned OpenGL functions working with the subclass pattern 2015-03-27 16:36:34 +00:00
tests Do not emit textEdited on inputMask change 2015-03-27 12:55:57 +00:00
tools configure: take XQMAKESPEC into account when looking for files. 2015-03-26 21:15:22 +00:00
util [locale database utility] Minor code deduplication 2015-03-23 07:08:31 +00:00
.gitattributes Update the git-archive export options 2012-09-07 15:39:31 +02:00
.gitignore Remove qtdemo from gitignore 2014-09-17 12:38:55 +02:00
.qmake.conf Enable -Werror for all of qtbase 2013-09-04 01:50:10 +02:00
.tag Update the git-archive export options 2012-09-07 15:39:31 +02:00
configure don't print "progress bar" when stdout is no tty 2015-03-27 13:29:53 +00:00
configure.bat support spaces in build and install dirs 2015-02-17 18:28:00 +00:00
header.BSD Updated BSD licensed file headers 2015-02-15 07:41:17 +00:00
header.FDL Update copyright headers 2015-02-11 06:49:51 +00:00
header.LGPL3 Update copyright headers 2015-02-11 06:49:51 +00:00
header.LGPL3-COMM Update copyright headers 2015-02-11 06:49:51 +00:00
header.LGPL21 Update copyright headers 2015-02-11 06:49:51 +00:00
header.LGPL-ONLY Update copyright headers 2015-02-11 06:49:51 +00:00
INSTALL Doc: Update links in INSTALL file 2015-02-16 09:06:41 +00:00
LGPL_EXCEPTION.txt Update copyright headers 2015-02-11 06:49:51 +00:00
LICENSE.FDL Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
LICENSE.LGPLv3 Update copyright headers 2015-02-11 06:49:51 +00:00
LICENSE.LGPLv21 Update copyright headers 2015-02-11 06:49:51 +00:00
LICENSE.PREVIEW.COMMERCIAL Update copyright headers 2015-02-11 06:49:51 +00:00
qtbase.pro remove nonsensical claim about contains() 2014-11-13 14:33:16 +01:00
sync.profile ANGLE: upgrade to 2.1~07d49ef5350a 2014-08-05 16:43:22 +02:00