summaryrefslogtreecommitdiff
path: root/dev-embedded/ponyprog/files/ponyprog-3.1.4_p20250501-usbwatcher-qt6.patch
blob: e66405ac5ce8e0abef41795b75ff15ff86b1aea6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
See https://github.com/lancos/ponyprog/issues/42
---

diff --git a/SrcPony/usbwatcher.h b/SrcPony/usbwatcher.h
index eeb0163..d7ab2c5 100644
--- a/SrcPony/usbwatcher.h
+++ b/SrcPony/usbwatcher.h
@@ -51,20 +51,22 @@ class USBWatcher : public QObject
 
 	void hotplug_notify(bool connected, quint16 vid, quint16 pid)
 	{
+		VidPid *vObj = new VidPid(vid, pid);
 		if (connected)
 		{
-			vUSB.append(VidPid(vid, pid));
+			vUSB.append(vObj);
 			emit notify(true, vid, pid);
 		}
 		else
 		{
-			int idx = vUSB.indexOf(VidPid(vid, pid));
+			int idx = vUSB.indexOf(vObj);
 			if (idx != -1)
 			{
 				vUSB.remove(idx);
 			}
 			emit notify(false, vid, pid);
 		}
+		delete vObj;
 	}
 
   signals:
@@ -76,7 +78,7 @@ class USBWatcher : public QObject
   private:
 	void hotplug_deregister();
 
-	QVector <VidPid> vUSB;
+	QVector <VidPid *> vUSB;
 	libusb_hotplug_callback_handle cbHandle;
 	libusb_context *usb_ctx;
 	QTimer *timer;