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; } }