When application was exited through 'back' button domain associated with
the running instance was destroyed, however the publishers and subscribers
registered within that domain were left intact.
This caused 'Application Not Responding' to be thrown when user wants to
start the application again, because it tries to use handles associated
with the now defunct publishers/subscribers.
In order to prevent this, we destroy Publisher and Subscriber objects upon
invocation of onDestroy() callback method.
public void onDestroy()
{
super.onDestroy();
-
+
+ for (PublisherShape shape : publisherView.shapes)
+ shape.killMe();
+
+ for (SubscriberElement element : subscriberView.elements)
+ element.killMe();
+
if (appDomain != null) {
appDomain.destroy();
appDomain = null;
*/
public void killMe()
{
- this.publication.destroy();
+ if (this.publication != null) {
+ this.publication.destroy();
+ this.publication = null;
+ }
}
/**
this.setShape();
}
+ /**
+ * When subscriber is removed, destroy subscription.
+ *
+ * @since 1.0
+ */
+ public void killMe() {
+ if (this.subscription != null) {
+ this.subscription.destroy();
+ this.subscription = null;
+ }
+ }
}