Skip to content

Commit 563a0f6

Browse files
Merge pull request #12 from sha0coder/main
Workarround to avoid the SEGFAULT case on libusb
2 parents 794a07d + a9fe2ca commit 563a0f6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/scapy_usbbluetooth/usbbluetooth_socket.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ def __init__(self, dev: Controller) -> None:
1717
self._dev = dev
1818
self._dev.open()
1919

20+
def __del__(self):
21+
# Workarround to avoid the SEGFAULT case on libusb.
22+
# self._dev.close() should not be called from a destructor.
23+
# this disables SuperSocket.__del__ that calls UsbBluetoothSocket.close()
24+
super().close()
25+
26+
2027
def send(self, x):
2128
# type: (Packet) -> int
2229
if HCI_Hdr not in x:

0 commit comments

Comments
 (0)