From 928cb68b0b257eeb34a6555ffe1882fddf975c59 Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Tue, 25 Oct 2016 11:21:23 +0900 Subject: [PATCH] ui: move Qt5 clean-up codes inside main() 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 --- tizen/src/ui/qt5.c | 4 ++-- tizen/src/ui/qt5.h | 1 + tizen/src/ui/rotaryview.cpp | 2 -- vl.c | 11 +++++++++++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tizen/src/ui/qt5.c b/tizen/src/ui/qt5.c index 561fe9c492..0b19be65bd 100644 --- a/tizen/src/ui/qt5.c +++ b/tizen/src/ui/qt5.c @@ -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; diff --git a/tizen/src/ui/qt5.h b/tizen/src/ui/qt5.h index d5e5de1a3d..226ea3759d 100644 --- a/tizen/src/ui/qt5.h +++ b/tizen/src/ui/qt5.h @@ -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); diff --git a/tizen/src/ui/rotaryview.cpp b/tizen/src/ui/rotaryview.cpp index 3297f3fc34..fdb6816d7f 100644 --- a/tizen/src/ui/rotaryview.cpp +++ b/tizen/src/ui/rotaryview.cpp @@ -193,6 +193,4 @@ RotaryView::~RotaryView() qDebug("destroy rotary view"); timer->stop(); - - scene()->clear(); } diff --git a/vl.c b/vl.c index d8b5697e93..2b9a29c1b4 100644 --- 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; } -- 2.34.1