forked from qt-creator/qt-creator
Fix crash when spliting GLSL editor
Not a good idea to keep the editor stored since when removing a split, for example, the editor will go away and the highlighter is not aware of it anyhow since it actually belongs to the document. Although it's not necessary for the fix this patch add another constructor to SyntaxHighlighter which takes the BaseTextDocument. This is convenient. Task-number: QTCREATORBUG-5695 Change-Id: Ic91837b7d91ebd3a44c16e2fd589d7f6c5c0c002 Reviewed-on: http://codereview.qt.nokia.com/2508 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
committed by
Leandro T. C. Melo
parent
ebb238c885
commit
3bf883997f
@@ -30,6 +30,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "syntaxhighlighter.h"
|
||||
#include "basetextdocument.h"
|
||||
|
||||
#include <qtextdocument.h>
|
||||
#include <qtextlayout.h>
|
||||
@@ -324,6 +325,13 @@ SyntaxHighlighter::SyntaxHighlighter(QTextDocument *parent)
|
||||
setDocument(parent);
|
||||
}
|
||||
|
||||
SyntaxHighlighter::SyntaxHighlighter(BaseTextDocument *parent)
|
||||
: d_ptr(new SyntaxHighlighterPrivate)
|
||||
{
|
||||
d_ptr->q_ptr = this;
|
||||
parent->setSyntaxHighlighter(this); // Extra logic (including setting the parent).
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a SyntaxHighlighter and installs it on \a parent 's
|
||||
QTextDocument. The specified QTextEdit also becomes the owner of
|
||||
|
||||
Reference in New Issue
Block a user