Commit cf09ac88 authored by hjk's avatar hjk
Browse files

Perforce: Don't crash on large log output



Change-Id: I3766d20f5faaa01f38418cdfdcc4977cf9189fc7
Reviewed-by: default avatarCristian Adam <cristian.adam@here.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 4bfe6f93
......@@ -1184,7 +1184,15 @@ IEditor *PerforcePlugin::showOutputInEditor(const QString &title,
qDebug() << "PerforcePlugin::showOutputInEditor" << title << id.name()
<< "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
QString s = title;
IEditor *editor = EditorManager::openEditorWithContents(id, &s, output.toUtf8());
QString content = output;
const int maxSize = EditorManager::maxTextFileSize() - 1000;
if (content.size() >= maxSize) {
content = tr("[Only %1 MB of output shown]").arg(maxSize / 1024 / 1024) + QLatin1Char('\n')
+ content.rightRef(maxSize);
}
IEditor *editor = EditorManager::openEditorWithContents(id, &s, content.toUtf8());
QTC_ASSERT(editor, return 0);
connect(editor, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)),
this, SLOT(vcsAnnotate(QString,QString,QString,int)));
PerforceEditorWidget *e = qobject_cast<PerforceEditorWidget*>(editor->widget());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment