解决取消扫描时,未取到图导致进度指示器界面卡死的问题

This commit is contained in:
yangjiaxuan 2023-11-30 09:11:51 +08:00
parent c5b71eb78f
commit 1b3e2be09e
2 changed files with 22 additions and 3 deletions

View File

@ -807,8 +807,27 @@ void scanner::scan_done(void)
{
std::string msg(scan_msg_);
while (images_.count())
std::this_thread::sleep_for(std::chrono::milliseconds(5));
if (err_ != SCANNER_ERR_USER_CANCELED)
{
int cnt = images_.count(), elapse = 0,
unit = 5, total = 1000;
while (cnt)
{
std::this_thread::sleep_for(std::chrono::milliseconds(unit));
elapse++;
if (cnt == images_.count())
{
if (elapse >= total / unit)
break;
}
else
{
elapse = 0;
}
cnt = images_.count();
}
}
if (indicator_)
indicator_->notify_scan_over(&msg[0], err_ != SCANNER_ERR_OK);

View File

@ -1699,7 +1699,7 @@ Result huagao_ds::call(const Identity& origin, DataGroup dg, Dat dat, Msg msg, v
//trigger_ProcessEvent(dg, dat, msg); // some APPs may be not trigger (Control, Event, ProcessEvent), we help them :( ... // 浜戦槄鍗锋壂鎻忕涓嶇瓑鐘舵€佹敼鍙橈紝鐩存帴鍙栧浘锛屾澶勮缃竴娆$姸鎬?2022-11-07
rt = Base::call(origin, dg, dat, msg, data);
if (log_all_triple_ || ((int)rt.returnCode() && rt.returnCode() != ReturnCode::NotDsEvent))
if (log_all_triple_ || ((int)rt.returnCode() && rt.returnCode() != ReturnCode::NotDsEvent && msg != Msg::ProcessEvent))
{
wchar_t dgs[20] = { 0 }, dts[20] = { 0 }, ms[20] = { 0 }, ss[20] = { 0 }, rcs[20] = { 0 }, cs[20] = { 0 };
if (dat == Dat::Capability)