diff options
author | Trond Kjernaasen <trond@trolltech.com> | 2009-09-28 14:52:04 (GMT) |
---|---|---|
committer | Trond Kjernaasen <trond@trolltech.com> | 2009-09-28 15:03:33 (GMT) |
commit | 14a896cf6b8b67a8d83a6204737249afa9ecd220 (patch) | |
tree | fc1989faa3e38afecb9108520f748eef5d694466 /demos | |
parent | 00ee879628e392ad46daf9cabe7c760c09afb6b7 (diff) | |
download | Qt-14a896cf6b8b67a8d83a6204737249afa9ecd220.zip Qt-14a896cf6b8b67a8d83a6204737249afa9ecd220.tar.gz Qt-14a896cf6b8b67a8d83a6204737249afa9ecd220.tar.bz2 |
Fixed a crash in the boxes demo when using -graphicssystem opengl.
Several problems:
1. The demo leaked the scene contents, which caused cleanup problems.
2. The QGLContext::currentContext() could be changed behind Qt's back
under Windows (the temp contexts never reset the current context).
3. QGLFormat::openGLVersionFlags() function would return uninitialized
flags if the QGLWidget constructor happened to call
qt_gl_preferGL2Engine().
Reviewed-by: Kim
Diffstat (limited to 'demos')
-rw-r--r-- | demos/boxes/main.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/demos/boxes/main.cpp b/demos/boxes/main.cpp index 557afc9..957f183 100644 --- a/demos/boxes/main.cpp +++ b/demos/boxes/main.cpp @@ -68,7 +68,7 @@ protected: inline bool matchString(const char *extensionString, const char *subString) { int subStringLength = strlen(subString); - return (strncmp(extensionString, subString, subStringLength) == 0) + return (strncmp(extensionString, subString, subStringLength) == 0) && ((extensionString[subStringLength] == ' ') || (extensionString[subStringLength] == '\0')); } @@ -137,11 +137,12 @@ int main(int argc, char **argv) "This demo can be GPU and CPU intensive and may\n" "work poorly or not at all on your system."); + widget->makeCurrent(); // The current context must be set before calling Scene's constructor + Scene scene(1024, 768, maxTextureSize); GraphicsView view; view.setViewport(widget); view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate); - widget->makeCurrent(); // The current context must be set before calling Scene's constructor - view.setScene(new Scene(1024, 768, maxTextureSize)); + view.setScene(&scene); view.show(); return app.exec(); |