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

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,
void DeviceProcessesDialogPrivate::setDevice(const IDevice::ConstPtr &device)
{
delete processList;
processList = 0;
proxyModel.setSourceModel(0);
if (!device)
return;
processList = device->createProcessListModel();
QTC_ASSERT(processList, return);
......@@ -246,7 +250,7 @@ void DeviceProcessesDialogPrivate::updateProcessList()
void DeviceProcessesDialogPrivate::killProcess()
{
const QModelIndexList indexes = procView->selectionModel()->selectedIndexes();
if (indexes.empty())
if (indexes.empty() || !processList)
return;
updateListButton->setEnabled(false);
killProcessButton->setEnabled(false);
......@@ -275,7 +279,7 @@ void DeviceProcessesDialogPrivate::updateButtons()
DeviceProcess DeviceProcessesDialogPrivate::selectedProcess() const
{
const QModelIndexList indexes = procView->selectionModel()->selectedIndexes();
if (indexes.empty())
if (indexes.empty() || !processList)
return DeviceProcess();
return processList->at(proxyModel.mapToSource(indexes.first()).row());
}
......
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