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 <QDesktopServices>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include <QRegularExpression>
|
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
namespace VcsBase {
|
namespace VcsBase {
|
||||||
|
|
||||||
VcsOutputFormatter::VcsOutputFormatter()
|
VcsOutputFormatter::VcsOutputFormatter() : m_urlRegexp("https?://\\S*") {}
|
||||||
{
|
|
||||||
m_urlRegexp = new QRegularExpression("https?://\\S*");
|
|
||||||
}
|
|
||||||
|
|
||||||
void VcsOutputFormatter::appendMessage(const QString &text, Utils::OutputFormat format)
|
void VcsOutputFormatter::appendMessage(const QString &text, Utils::OutputFormat format)
|
||||||
{
|
{
|
||||||
QString out = text;
|
QString out = text;
|
||||||
const QRegularExpressionMatch match = m_urlRegexp->match(text);
|
const QRegularExpressionMatch match = m_urlRegexp.match(text);
|
||||||
if (match.hasMatch()) {
|
if (match.hasMatch()) {
|
||||||
const QTextCharFormat normalFormat = charFormat(format);
|
const QTextCharFormat normalFormat = charFormat(format);
|
||||||
OutputFormatter::appendMessage(text.left(match.capturedStart()), format);
|
OutputFormatter::appendMessage(text.left(match.capturedStart()), format);
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include <utils/outputformatter.h>
|
#include <utils/outputformatter.h>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QRegularExpression);
|
#include <QRegularExpression>
|
||||||
|
|
||||||
namespace VcsBase {
|
namespace VcsBase {
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
void handleLink(const QString &href) override;
|
void handleLink(const QString &href) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QRegularExpression *m_urlRegexp = nullptr;
|
const QRegularExpression m_urlRegexp;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user