Move finalize logic to quit procedure 41/233941/2
authorliwei <wei90727.li@samsung.com>
Wed, 20 May 2020 11:05:33 +0000 (19:05 +0800)
committerliwei <wei90727.li@samsung.com>
Thu, 21 May 2020 05:37:34 +0000 (13:37 +0800)
Because in current logic, "before-quit" will not be invoked,
so webApplication.finalize() is not called, it will cause RWI
port is not relased / dialog is not cancled/..., so move to
"quit" procedure.

After "Fix terminate crash issue by appfw" patch, "before-quit"/
'will-quit' will not be invoked(https://review.tizen.org/gerrit/233246/).

Change-Id: I0623b2d1147f1b1c31e809f67f270ae2974662cc
Signed-off-by: liwei <wei90727.li@samsung.com>
wrt_app/src/runtime.js

index 30301b8..b0d97ff 100755 (executable)
@@ -34,10 +34,8 @@ class Runtime {
         var _this = this;
         app.on('before-quit', function(event) {
             console.log('before-quit');
-            if (!wrt.isElectronApp()) {
+            if (_this.webApplication) {
                 _this.webApplication.quit();
-                _this.webApplication.finalize();
-                _this.webApplication = null;
             }
         });
         app.on('will-quit', function(event) {
@@ -46,6 +44,10 @@ class Runtime {
         });
         app.on('quit', function(event) {
             console.log('quit');
+            if (_this.webApplication) {
+                _this.webApplication.finalize();
+                _this.webApplication = null;
+            }
             wrt.exit();
         });
         app.on('browser-window-blur', function() {