summaryrefslogtreecommitdiff
path: root/src/plugins/glsleditor
diff options
context:
space:
mode:
authorhjk <hjk@theqtcompany.com>2015-01-13 14:26:33 +0100
committerhjk <hjk@theqtcompany.com>2015-01-13 14:54:10 +0100
commit41d1c7e0e11da97258f0b592a2ce9f64b1f09c36 (patch)
treefb727208dc4e0ee8872f2986cef63dfca177678b /src/plugins/glsleditor
parent3945243e86325b24701b231ef0fa4dc9729a0429 (diff)
downloadqt-creator-41d1c7e0e11da97258f0b592a2ce9f64b1f09c36.tar.gz
GLSL: Do not leak engine
Change-Id: I756361cc2aa4ad7bd91acde23dc0267520c6490c Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Diffstat (limited to 'src/plugins/glsleditor')
-rw-r--r--src/plugins/glsleditor/glsleditor.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp
index 3f3af8751c..e624bd8219 100644
--- a/src/plugins/glsleditor/glsleditor.cpp
+++ b/src/plugins/glsleditor/glsleditor.cpp
@@ -213,13 +213,13 @@ void GlslEditorWidget::updateDocumentNow()
const QByteArray preprocessedCode = contents.toLatin1(); // ### use the QtCreator C++ preprocessor.
Document::Ptr doc(new Document());
- Engine *engine = new GLSL::Engine();
+ Engine engine;
doc->_engine = new GLSL::Engine();
Parser parser(doc->_engine, preprocessedCode.constData(), preprocessedCode.size(), variant);
TranslationUnitAST *ast = parser.parse();
if (ast != 0 || extraSelections(CodeWarningsSelection).isEmpty()) {
Semantic sem;
- Scope *globalScope = engine->newNamespace();
+ Scope *globalScope = engine.newNamespace();
doc->_globalScope = globalScope;
const GlslEditorPlugin::InitFile *file = GlslEditorPlugin::shaderInit(variant);
sem.translationUnit(file->ast, globalScope, file->engine);
@@ -231,7 +231,7 @@ void GlslEditorWidget::updateDocumentNow()
file = GlslEditorPlugin::fragmentShaderInit(variant);
sem.translationUnit(file->ast, globalScope, file->engine);
}
- sem.translationUnit(ast, globalScope, engine);
+ sem.translationUnit(ast, globalScope, &engine);
CreateRanges createRanges(document(), doc);
createRanges(ast);
@@ -247,7 +247,7 @@ void GlslEditorWidget::updateDocumentNow()
QList<QTextEdit::ExtraSelection> sels;
QSet<int> errors;
- foreach (const DiagnosticMessage &m, engine->diagnosticMessages()) {
+ foreach (const DiagnosticMessage &m, engine.diagnosticMessages()) {
if (! m.line())
continue;
else if (errors.contains(m.line()))