From c9e2911bdb07fe817b75947c6e896552fa64cddf Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 6 Mar 2022 16:56:54 +0900 Subject: tdehwdevicemanager: fix SEGV caused by removing a device when the Device list dialog is open. Also make sure to update the device list correctly when a device is removed. Signed-off-by: Michele Calgaro --- kcontrol/hwmanager/deviceiconview.h | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'kcontrol/hwmanager/deviceiconview.h') diff --git a/kcontrol/hwmanager/deviceiconview.h b/kcontrol/hwmanager/deviceiconview.h index 913c4c9ef..746fb2253 100644 --- a/kcontrol/hwmanager/deviceiconview.h +++ b/kcontrol/hwmanager/deviceiconview.h @@ -32,31 +32,25 @@ class ConfigModuleList; class DeviceIconItem : public TDEListViewItem { public: - DeviceIconItem(TQListViewItem *parent, const TQString& text, const TQPixmap& pm, TDEGenericDevice *d = 0) + DeviceIconItem(TQListViewItem *parent, const TQString& text, const TQPixmap& pm, TQString deviceUid) : TDEListViewItem(parent, text) - , _tag(TQString::null) - , _device(d) + , _deviceUid(deviceUid) { setPixmap(0, pm); } - DeviceIconItem(TQListView *parent, const TQString& text, const TQPixmap& pm, TDEGenericDevice *d = 0) + DeviceIconItem(TQListView *parent, const TQString& text, const TQPixmap& pm, TQString deviceUid) : TDEListViewItem(parent, text) - , _tag(TQString::null) - , _device(d) + , _deviceUid(deviceUid) { setPixmap(0, pm); } - void setDevice(TDEGenericDevice* d) { _device = d; } - void setTag(const TQString& t) { _tag = t; } + void setDevice(TQString deviceUid) { _deviceUid = deviceUid; } - TDEGenericDevice* device() { return _device; } - TQString tag() { return _tag; } - + TDEGenericDevice* device() { return TDEGlobal::hardwareDevices()->findByUniqueID(_deviceUid); } private: - TQString _tag; - TDEGenericDevice *_device; + TQString _deviceUid; // device unique id }; class DeviceIconView : public TDEListView -- cgit v1.2.1