From 9d43c38e091611235865fafed7818ccb833bb548 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Fri, 20 Sep 2019 17:58:50 +0800 Subject: [PATCH] add exit event --- tests/YuvDisplayer.h | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/tests/YuvDisplayer.h b/tests/YuvDisplayer.h index 476b57ee..1cd77867 100644 --- a/tests/YuvDisplayer.h +++ b/tests/YuvDisplayer.h @@ -71,20 +71,26 @@ public: SDL_Event event; while(flag){ SDL_WaitEvent(&event); - if (event.type == REFRESH_EVENT) - { - { - lock_guard lck(_mtxTask); - if(_taskList.empty()){ - //not reachable - continue; - } - task = _taskList.front(); - _taskList.pop_front(); - } - flag = task(); - } - + switch (event.type){ + case REFRESH_EVENT:{ + { + lock_guard lck(_mtxTask); + if(_taskList.empty()){ + //not reachable + continue; + } + task = _taskList.front(); + _taskList.pop_front(); + } + flag = task(); + break; + case SDL_QUIT: + InfoL << event.type; + return; + } + default: + break; + } } }