Commit 40a6f0b1 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by hjk
Browse files

Attach to Process: Fix crash



When a non-desktop kit has no device

Change-Id: I108f3f65d151183be1d40d659dc331e9bc57c48e
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 935f3de0
...@@ -204,6 +204,10 @@ DeviceProcessesDialogPrivate::DeviceProcessesDialogPrivate(KitChooser *chooser, ...@@ -204,6 +204,10 @@ DeviceProcessesDialogPrivate::DeviceProcessesDialogPrivate(KitChooser *chooser,
void DeviceProcessesDialogPrivate::setDevice(const IDevice::ConstPtr &device) void DeviceProcessesDialogPrivate::setDevice(const IDevice::ConstPtr &device)
{ {
delete processList; delete processList;
processList = 0;
proxyModel.setSourceModel(0);
if (!device)
return;
processList = device->createProcessListModel(); processList = device->createProcessListModel();
QTC_ASSERT(processList, return); QTC_ASSERT(processList, return);
...@@ -246,7 +250,7 @@ void DeviceProcessesDialogPrivate::updateProcessList() ...@@ -246,7 +250,7 @@ void DeviceProcessesDialogPrivate::updateProcessList()
void DeviceProcessesDialogPrivate::killProcess() void DeviceProcessesDialogPrivate::killProcess()
{ {
const QModelIndexList indexes = procView->selectionModel()->selectedIndexes(); const QModelIndexList indexes = procView->selectionModel()->selectedIndexes();
if (indexes.empty()) if (indexes.empty() || !processList)
return; return;
updateListButton->setEnabled(false); updateListButton->setEnabled(false);
killProcessButton->setEnabled(false); killProcessButton->setEnabled(false);
...@@ -275,7 +279,7 @@ void DeviceProcessesDialogPrivate::updateButtons() ...@@ -275,7 +279,7 @@ void DeviceProcessesDialogPrivate::updateButtons()
DeviceProcess DeviceProcessesDialogPrivate::selectedProcess() const DeviceProcess DeviceProcessesDialogPrivate::selectedProcess() const
{ {
const QModelIndexList indexes = procView->selectionModel()->selectedIndexes(); const QModelIndexList indexes = procView->selectionModel()->selectedIndexes();
if (indexes.empty()) if (indexes.empty() || !processList)
return DeviceProcess(); return DeviceProcess();
return processList->at(proxyModel.mapToSource(indexes.first()).row()); return processList->at(proxyModel.mapToSource(indexes.first()).row());
} }
......
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