Commit cd8bc8a2 authored by con's avatar con
Browse files

Opening binary files leaves empty entries in open editors window

Leading to a crash when selecting the empty entry.
The patch fixes a big memory leak with bin editors (neither the widget
nor the IFile instance was deleted, the latter leading to the empty
entry in the open editors window), and also puts a saveguard in the open
editors window, so that empty entries are not shown any more.

Task-number: QTCREATORBUG-571
Reviewed-by: Thorbjørn
parent 1da2e9e8
......@@ -297,12 +297,11 @@ class BinEditorInterface : public Core::IEditor
BinEditorInterface(BinEditor *parent)
: Core::IEditor(parent)
BinEditorInterface(BinEditor *editor)
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_editor = parent;
m_file = new BinEditorFile(parent);
m_editor = editor;
m_file = new BinEditorFile(m_editor);
m_context << uidm->uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR);
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR);
m_cursorPositionLabel = new Utils::LineColumnLabel;
......@@ -321,7 +320,9 @@ public:
connect(m_editor, SIGNAL(cursorPositionChanged(int)), this, SLOT(updateCursorPosition(int)));
~BinEditorInterface() {}
~BinEditorInterface() {
delete m_editor;
QWidget *widget() { return m_editor; }
......@@ -32,6 +32,8 @@
#include "editormanager.h"
#include "editorview.h"
#include <utils/qtcassert.h>
#include <QtGui/QHeaderView>
......@@ -201,11 +203,10 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
foreach (const EditLocation &hi, view->editorHistory()) {
if (hi.file.isNull() || filesDone.contains(hi.file))
QString title = model->displayNameForFile(hi.file);
QTC_ASSERT(!title.isEmpty(), continue;)
QTreeWidgetItem *item = new QTreeWidgetItem();
QString title = model->displayNameForFile(hi.file);
if (hi.file->isModified())
title += tr("*");
item->setIcon(0, hi.file->isReadOnly() ? lockedIcon : emptyIcon);
Supports Markdown
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