Skip to content

Commit

Permalink
Fix crash on closing a tab
Browse files Browse the repository at this point in the history
  • Loading branch information
gnufied committed Sep 7, 2014
1 parent c9f3dfa commit 2936fd2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions rbkit-lib/heapdumpform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ HeapDumpForm::HeapDumpForm(QWidget* parent, int _snapShotVersion)
HeapDumpForm::~HeapDumpForm()
{
delete ui;
delete proxyModel;
delete model;
delete rootItem;
}
Expand All @@ -45,19 +44,19 @@ void HeapDumpForm::loaData()
{
rootItem = RBKit::SqlConnectionPool::getInstance()->rootOfSnapshot(snapShotVersion);
model = new RBKit::HeapDataModel(rootItem, this);
proxyModel = new SortObjectProxyModel(this);
proxyModel->setSourceModel(model);
ui->treeView->setModel(proxyModel);
// proxyModel = new SortObjectProxyModel(this);
// proxyModel->setSourceModel(model);
ui->treeView->setModel(model);
adjustColumnWidth();
}

void HeapDumpForm::loadSelectedReferences(RBKit::HeapItem *_selectedItem)
{
rootItem = _selectedItem->getSelectedReferences();
model = new RBKit::HeapDataModel(rootItem, this);
proxyModel = new SortObjectProxyModel(this);
proxyModel->setSourceModel(model);
ui->treeView->setModel(proxyModel);
// proxyModel = new SortObjectProxyModel(this);
// proxyModel->setSourceModel(model);
ui->treeView->setModel(model);
adjustColumnWidth();
}

Expand All @@ -76,7 +75,7 @@ void HeapDumpForm::onCustomContextMenu(const QPoint &point)
if (disableRightClick)
return;
QPoint localPoint = ui->treeView->viewport()->mapToGlobal(point);
QModelIndex index = proxyModel->mapToSource(ui->treeView->indexAt(point));
QModelIndex index = ui->treeView->indexAt(point);
if (index.isValid()) {
selecteItem = static_cast<RBKit::HeapItem *>(index.internalPointer());
QMenu menu(this);
Expand Down

0 comments on commit 2936fd2

Please sign in to comment.