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>
This commit is contained in:
Robert Loehning
2015-09-25 13:14:31 +02:00
parent 734725ffc8
commit b92c00bab6
2 changed files with 11 additions and 3 deletions

View File

@@ -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(); };