From 9524f9fcc23b6414fbd0b0cd10bff5f61acc236a Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Wed, 21 Feb 2024 11:14:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9B=BD=E4=BA=A7=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E7=82=B9=E5=87=BB=E5=8F=96=E6=B6=88=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E6=8A=A5io=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9BBUG-903?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/sane_user/HGSaneImpl.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/sane_user/HGSaneImpl.cpp b/modules/sane_user/HGSaneImpl.cpp index 5a63172f..9e9b7caa 100644 --- a/modules/sane_user/HGSaneImpl.cpp +++ b/modules/sane_user/HGSaneImpl.cpp @@ -1104,8 +1104,16 @@ void HGAPI HGSaneDeviceImpl::ThreadFunc(HGThread thread, HGPointer param) if (readSize != params.bytes_per_line * params.lines) { free(buffer); - if (NULL != p->m_scanNotify) - p->m_scanNotify((int)SANE_EVENT_SCAN_FINISHED, (void*)saneAPI.sane_strstatus_api(SANE_STATUS_IO_ERROR), (int)SANE_STATUS_IO_ERROR); + if (p->m_cancelScan) + { + if (NULL != p->m_scanNotify) + p->m_scanNotify((int)SANE_EVENT_SCAN_FINISHED, (void*)saneAPI.sane_strstatus_api(SANE_STATUS_CANCELLED), (int)SANE_STATUS_CANCELLED); + } + else + { + if (NULL != p->m_scanNotify) + p->m_scanNotify((int)SANE_EVENT_SCAN_FINISHED, (void*)saneAPI.sane_strstatus_api(SANE_STATUS_IO_ERROR), (int)SANE_STATUS_IO_ERROR); + } break; } }