Skip to content

Commit a3fccc8

Browse files
committed
nulling out interfaces on exit, so the restart does not attempt to close
stale references
1 parent e9bf1d9 commit a3fccc8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

javasdk/NRSDK/addons/com/neuronrobotics/sdk/javaxusb/UsbCDCSerialConnection.java

+4
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,10 @@ private void localDisconnect(){
481481
try {
482482
if(camInpipe!=null)
483483
camInpipe.close();
484+
camInpipe=null;
484485
if(camOutpipe!=null)
485486
camOutpipe.close();
487+
camOutpipe=null;
486488
} catch (UsbNotActiveException | UsbNotOpenException
487489
| UsbDisconnectedException | UsbException e1) {
488490
// TODO Auto-generated catch block
@@ -493,6 +495,7 @@ private void localDisconnect(){
493495
if (dataInterface.isClaimed()){
494496
try {
495497
dataInterface.release();
498+
dataInterface=null;
496499
} catch (UsbNotActiveException |
497500
UsbDisconnectedException
498501
| UsbException e) {
@@ -506,6 +509,7 @@ private void localDisconnect(){
506509
//LibUsb.attachKernelDriver(deviceHandle, interfaceNumber);
507510
try{
508511
LibUsb.close(deviceHandle);
512+
deviceHandle=null;
509513
}catch(IllegalStateException e){
510514
e.printStackTrace();
511515
}

0 commit comments

Comments
 (0)