Cleanup on destroy

This commit is contained in:
Sebastián Katzer 2016-08-01 17:00:33 +02:00
parent 86a74dc2ff
commit 50f9bcfd4e

View File

@ -49,17 +49,10 @@ public final class PrinterDiscoverySession {
throws Throwable {
if (method.getName().equals("onPrintersChanged")) {
onPrintersChanged();
notifyOnPrintersChanged();
return null;
} 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.
*/
public final void destroy() {
stopPrinterDiscovery();
setOnPrintersChangeListener(null);
Meta.invokeMethod(session, "destroy");
session = null;
}
/**