summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Loehning <robert.loehning@theqtcompany.com>2015-09-25 13:14:31 +0200
committerRobert Loehning <robert.loehning@theqtcompany.com>2015-09-25 12:23:16 +0000
commitb92c00bab63ccd55144698b60e909e1966520c02 (patch)
tree5400a5373af6ca9d6b9332691afec64b2d4c4130
parent734725ffc88e5b04f1ed7d7f801e0b39e7580756 (diff)
downloadqt-creator-b92c00bab63ccd55144698b60e909e1966520c02.tar.gz
Check in initialize if OpenGl context can be created
Change-Id: I224c2559c1e65cfc3b699e7ec7b56dee8308bd83 Task-number: QTCREATORBUG-15101 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.cpp7
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerplugin.cpp7
2 files changed, 11 insertions, 3 deletions
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp
index 11e67f24eb..b943534d6a 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.cpp
+++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp
@@ -60,6 +60,7 @@
#include <qplugin.h>
#include <QDebug>
#include <QProcessEnvironment>
+#include <QOpenGLContext>
namespace QmlDesigner {
@@ -125,8 +126,10 @@ QmlDesignerPlugin::~QmlDesignerPlugin()
////////////////////////////////////////////////////
bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage/* = 0*/) // =0;
{
- if (errorMessage)
- errorMessage->clear();
+ if (!QOpenGLContext().create()) {
+ *errorMessage = tr("Cannot create OpenGL context.");
+ return false;
+ }
data = new QmlDesignerPluginData;
diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
index adb1db87dc..4b45c9b968 100644
--- a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
@@ -37,6 +37,7 @@
#include <analyzerbase/analyzermanager.h>
#include <extensionsystem/pluginmanager.h>
+#include <QOpenGLContext>
#include <QtPlugin>
using namespace Analyzer;
@@ -50,7 +51,11 @@ QmlProfilerPlugin *QmlProfilerPlugin::instance = 0;
bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString)
{
Q_UNUSED(arguments)
- Q_UNUSED(errorString)
+
+ if (!QOpenGLContext().create()) {
+ *errorString = tr("Cannot create OpenGL context.");
+ return false;
+ }
auto tool = new QmlProfilerTool(this);
auto widgetCreator = [tool] { return tool->createWidgets(); };