From 50f9bcfd4eb088268444a7a86cd28564d332cdcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Mon, 1 Aug 2016 17:00:33 +0200 Subject: [PATCH] Cleanup on destroy --- src/android/ext/PrinterDiscoverySession.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/android/ext/PrinterDiscoverySession.java b/src/android/ext/PrinterDiscoverySession.java index b04da82..e4802be 100644 --- a/src/android/ext/PrinterDiscoverySession.java +++ b/src/android/ext/PrinterDiscoverySession.java @@ -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; } /**