https://bugs.kde.org/show_bug.cgi?id=404820
Bug ID: 404820
Summary: default construction SyntaxHighlighter() crashes
Product: frameworks-syntax-highlighting
Version: 5.55.0
Platform: Other
OS: All
Status: REPORTED
Severity: crash
Priority: NOR
Component: framework
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
SUMMARY
SyntaxHighlighter(QObject* parent = nullptr) calls QSyntaxHighlighter(parent).
If parent == nullptr, this crashes because QSyntaxHighlighter(QObject *parent)
dereferences parent without checking for nullptr. This could be considered a
bug in QSyntaxHighlighter. However, QSyntaxHighlighter does not have a default
argument nullptr but SyntaxHighlighter does.
I do not see a way to fix SyntaxHighlighter so that SyntaxHighlighter() can be
called without crashing. Ideally, one would do this:
SyntaxHighlighter::SyntaxHighlighter(QObject* parent) :
QSyntaxHighlighter(parent ?QSyntaxHighlighter(parent)
:QSyntaxHighlighter((QTextDocument*)0)),
AbstractHighlighter(new SyntaxHighlighterPrivate)
{
qRegisterMetaType<QTextBlock>();
}
but that does not compile.
Is there a way to choose what superclass constructor to call at runtime?
--
You are receiving this mail because:
You are watching all bug changes.