36e0a64f81
This reverts commit 46dd028a33
.
The above commit caused a regression - issue #281
As seen in valgrind, crash was caused by portModel reset writing into
a freed block - presumably pertaining to persistent indexes. The block
was freed by the persistent index itself earlier when it was set to
invalid - so the model should not have been accessing that.
The application code seems correct - maybe the Qt code has a bug?
Unlikely but not impossible. For now go back to using QModelIndex
instead of QPersistentModelIndex
Fixes #281
66 lines
1.7 KiB
C++
66 lines
1.7 KiB
C++
/*
|
|
Copyright (C) 2016 Srivats P.
|
|
|
|
This file is part of "Ostinato"
|
|
|
|
This is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
*/
|
|
|
|
#ifndef _DEVICES_WIDGET_H
|
|
#define _DEVICES_WIDGET_H
|
|
|
|
#include "ui_deviceswidget.h"
|
|
#include <QWidget>
|
|
|
|
class PortGroupList;
|
|
|
|
class DevicesWidget: public QWidget, private Ui::DevicesWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
DevicesWidget(QWidget *parent = NULL);
|
|
void setPortGroupList(PortGroupList *portGroups);
|
|
|
|
virtual void keyPressEvent(QKeyEvent *event);
|
|
|
|
public slots:
|
|
void setCurrentPortIndex(const QModelIndex &portIndex);
|
|
|
|
private slots:
|
|
void updateDeviceViewActions();
|
|
|
|
void on_deviceInfo_toggled(bool checked);
|
|
|
|
void on_actionNewDeviceGroup_triggered();
|
|
void on_actionDeleteDeviceGroup_triggered();
|
|
void on_actionEditDeviceGroup_triggered();
|
|
void on_deviceGroupList_activated(const QModelIndex &index);
|
|
|
|
void on_refresh_clicked();
|
|
void on_resolveNeighbors_clicked();
|
|
void on_clearNeighbors_clicked();
|
|
|
|
void when_deviceList_currentChanged(const QModelIndex &index);
|
|
|
|
private:
|
|
void setDeviceInfoButtonsVisible(bool show);
|
|
|
|
PortGroupList *portGroups_;
|
|
QModelIndex currentPortIndex_;
|
|
};
|
|
|
|
#endif
|
|
|