forked from qt-creator/qt-creator
VcsBase: Fix memory leak
Change-Id: Icb0c2a86ee0d5a1e22dc17fbc2a5d155b928e459 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -25,21 +25,17 @@
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QRegularExpression>
|
||||
#include <QTextCursor>
|
||||
#include <QUrl>
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
VcsOutputFormatter::VcsOutputFormatter()
|
||||
{
|
||||
m_urlRegexp = new QRegularExpression("https?://\\S*");
|
||||
}
|
||||
VcsOutputFormatter::VcsOutputFormatter() : m_urlRegexp("https?://\\S*") {}
|
||||
|
||||
void VcsOutputFormatter::appendMessage(const QString &text, Utils::OutputFormat format)
|
||||
{
|
||||
QString out = text;
|
||||
const QRegularExpressionMatch match = m_urlRegexp->match(text);
|
||||
const QRegularExpressionMatch match = m_urlRegexp.match(text);
|
||||
if (match.hasMatch()) {
|
||||
const QTextCharFormat normalFormat = charFormat(format);
|
||||
OutputFormatter::appendMessage(text.left(match.capturedStart()), format);
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <utils/outputformatter.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QRegularExpression);
|
||||
#include <QRegularExpression>
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
void handleLink(const QString &href) override;
|
||||
|
||||
private:
|
||||
QRegularExpression *m_urlRegexp = nullptr;
|
||||
const QRegularExpression m_urlRegexp;
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user