ui: move Qt5 clean-up codes inside main()
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 25 Oct 2016 02:21:23 +0000 (11:21 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 2 Nov 2016 05:42:02 +0000 (14:42 +0900)
Qt5 resource clean-up in exit handler cause several unexpected
behaviors include segmentation fault. So it is moved inside
main() function, then clean-up is done before main function exit.

Change-Id: I4f53d531261f376de869e9c286bd700f9acbf726
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
tizen/src/ui/qt5.c
tizen/src/ui/qt5.h
tizen/src/ui/rotaryview.cpp
vl.c

index 561fe9c..0b19be6 100644 (file)
@@ -156,7 +156,8 @@ void maru_early_qt5_display_init(bool isOnscreen)
     }
 }
 
-static void maru_qt5_display_fini(void)
+// should be called before exit main()
+void maru_qt5_display_fini(void)
 {
     if (qt5_console) {
         g_free(qt5_console);
@@ -212,7 +213,6 @@ void maru_qt5_display_init(DisplayState *ds, int full_screen)
     if (full_screen) {
         /* TODO */
     }
-    atexit(maru_qt5_display_fini);
 
     /* TODO
     mouse_mode_notifier.notify = qt2_mouse_mode_change;
index d5e5de1..226ea37 100644 (file)
@@ -36,6 +36,7 @@
 
 void maru_early_qt5_display_init(bool isOnscreen);
 void maru_qt5_display_init(DisplayState *ds, int full_screen);
+void maru_qt5_display_fini(void);
 
 void set_display_pixel_density(int dpi);
 int get_display_pixel_density(void);
index 3297f3f..fdb6816 100644 (file)
@@ -193,6 +193,4 @@ RotaryView::~RotaryView()
     qDebug("destroy rotary view");
 
     timer->stop();
-
-    scene()->clear();
 }
diff --git a/vl.c b/vl.c
index d8b5697..2b9a29c 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -4884,5 +4884,16 @@ int main(int argc, char **argv, char **envp)
     tpm_cleanup();
 #endif
 
+#if defined(CONFIG_MARU) && defined(CONFIG_QT)
+    switch (display_type) {
+    case DT_MARU_QT_ONSCREEN:
+    case DT_MARU_QT_OFFSCREEN:
+        maru_qt5_display_fini();
+        break;
+    default:
+        break;
+    }
+#endif
+
     return 0;
 }