Cleanup on destroy
This commit is contained in:
parent
86a74dc2ff
commit
50f9bcfd4e
@ -49,17 +49,10 @@ public final class PrinterDiscoverySession {
|
|||||||
throws Throwable {
|
throws Throwable {
|
||||||
|
|
||||||
if (method.getName().equals("onPrintersChanged")) {
|
if (method.getName().equals("onPrintersChanged")) {
|
||||||
onPrintersChanged();
|
notifyOnPrintersChanged();
|
||||||
return null;
|
return null;
|
||||||
} else throw new Exception();
|
} else throw new Exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delegate the event to the listener.
|
|
||||||
*/
|
|
||||||
public void onPrintersChanged() {
|
|
||||||
notifyOnPrintersChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,7 +145,10 @@ public final class PrinterDiscoverySession {
|
|||||||
* Destroy the session if not already done.
|
* Destroy the session if not already done.
|
||||||
*/
|
*/
|
||||||
public final void destroy() {
|
public final void destroy() {
|
||||||
|
stopPrinterDiscovery();
|
||||||
|
setOnPrintersChangeListener(null);
|
||||||
Meta.invokeMethod(session, "destroy");
|
Meta.invokeMethod(session, "destroy");
|
||||||
|
session = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user