diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index f7cbfa4ad..129f19dbc 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -83,8 +83,10 @@ bool CComponentsTimer::startTimer() return false; } if (res == 0){ - dprintf(DEBUG_INFO,"\033[33m[CComponentsTimer] [%s - %d] timer thread [%lu] created with interval = %d\033[0m\n", __func__, __LINE__, pthread_self(), tm_interval); - CNeutrinoApp::getInstance()->OnBeforeRestart.connect(sl); + if (!sl.empty()){ + dprintf(DEBUG_INFO,"\033[33m[CComponentsTimer] [%s - %d] timer thread [%lu] created with interval = %d\033[0m\n", __func__, __LINE__, pthread_self(), tm_interval); + CNeutrinoApp::getInstance()->OnBeforeRestart.connect(sl); + } }else{ dprintf(DEBUG_NORMAL, "\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_create\033[0m\n", __func__, __LINE__); } @@ -107,9 +109,12 @@ bool CComponentsTimer::stopTimer() if (thres == 0){ tm_thread = 0; + dprintf(DEBUG_INFO,"\033[33m[CComponentsTimer] [%s] timer thread terminated ...\033[0m\n", __func__); //ensure disconnect of unused slot - sl.disconnect(); - dprintf(DEBUG_INFO,"\033[33m[CComponentsTimer] [%s] timer thread terminated ...\033[0m\n", __func__); + if (!sl.empty()){ + dprintf(DEBUG_INFO,"\033[33m[CComponentsTimer][%s] disconnect timer slot ...\033[0m\n", __func__); + sl.disconnect(); + } return true; } }