changeset 2260:f9af7b6a08eb

Fixed PR557 - Applet opens in a separate window if tab is closed when the applet loads
author Deepak Bhole <dbhole@redhat.com>
date Fri, 17 Sep 2010 17:01:12 -0400
parents ddbf2447886c
children ed033548219c
files ChangeLog NEWS plugin/icedteanp/IcedTeaNPPlugin.cc
diffstat 3 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Sep 17 17:36:07 2010 +0100
+++ b/ChangeLog	Fri Sep 17 17:01:12 2010 -0400
@@ -1,3 +1,11 @@
+2010-09-17  Deepak Bhole <dbhole@redhat.com>
+
+	PR557: Applet opens in a separate window if tab is closed when the applet
+	loads
+	* plugin/icedteanp/IcedTeaNPPlugin.cc 
+	(ITNP_Destroy): Send a destroy message to let Java side know that the
+	applet needs to be destroyed.
+
 2010-09-17  Andrew John Hughes  <ahughes@redhat.com>
 
 	* Makefile.am:
--- a/NEWS	Fri Sep 17 17:36:07 2010 +0100
+++ b/NEWS	Fri Sep 17 17:01:12 2010 -0400
@@ -20,6 +20,7 @@
   - A new man page for javaws.
 * Plugin  
   - PR556: Applet initialization code is prone to race conditions
+  - PR557: Applet opens in a separate window if tab is closed when the applet loads
 
 New in release 1.9 (2010-09-07):
 
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Fri Sep 17 17:36:07 2010 +0100
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Fri Sep 17 17:01:12 2010 -0400
@@ -634,14 +634,21 @@
 
   ITNPPluginData* data = (ITNPPluginData*) instance->pdata;
 
+  int id = get_id_from_instance(instance);
+
+  // Let Java know that this applet needs to be destroyed
+  gchar* msg = (gchar*) g_malloc(512*sizeof(gchar)); // 512 is more than enough. We need < 100
+  g_sprintf(msg, "instance %d destroy", id);
+  plugin_send_message_to_appletviewer(msg);
+  g_free(msg);
+  msg = NULL;
+
   if (data)
     {
       // Free plugin data.
       plugin_data_destroy (instance);
     }
 
-  int id = get_id_from_instance(instance);
-
   g_hash_table_remove(instance_to_id_map, instance);
   g_hash_table_remove(id_to_instance_map, GINT_TO_POINTER(id));