[TV] Bring cancelDialogs() forward to before-quit 53/245553/4
authorDongHyun Song <dh81.song@samsung.com>
Mon, 12 Oct 2020 08:32:23 +0000 (17:32 +0900)
committerDongHyun Song <dh81.song@samsung.com>
Thu, 22 Oct 2020 07:52:17 +0000 (16:52 +0900)
With below refactor patch,
  https://review.tizen.org/gerrit/245417/

Defered timing of closing windows, Sometimes, JS exception is
coming due to access of destroyed Object at

  wrt.tv.cancelDialogs(this.mainWindow.webContents);

Change-Id: I207c890cb84e6aaec8ed13316c39b80dd2e6cd3c
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
wrt_app/src/web_application.ts

index 3e5a683..3795a2a 100644 (file)
@@ -381,22 +381,22 @@ Then you can get profile log from the initial loading.`;
 
   finalize() {
     console.log('WebApplication : finalize');
+    this.flushData();
+    this.windowList.forEach((window) => window.removeAllListeners());
+  }
+
+  quit() {
+    console.log('WebApplication : quit');
+    addonManager.emit('lcQuit', this.mainWindow.id);
     if (wrt.tv) {
       this.inspectorSrc = '';
       wrt.tv.cancelDialogs(this.mainWindow.webContents);
     }
-    this.flushData();
     if (this.debugPort) {
       console.log('stop inspector server');
       this.debugPort = 0;
       wrt.stopInspectorServer();
     }
-    this.windowList.forEach((window) => window.removeAllListeners());
-  }
-
-  quit() {
-    console.log('WebApplication : quit');
-    addonManager.emit('lcQuit', this.mainWindow.id);
     this.inQuit = true;
     if (!this.suspended)
       this.suspend();