From 2724c111bb15c7682e46c30c0b5e0475dd216775 Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Sat, 22 Oct 2022 14:46:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=A0=E5=86=85=E5=AD=98?= =?UTF-8?q?=E5=88=86=E9=85=8D=E5=A4=B1=E8=B4=A5=E9=80=80=E5=87=BA=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E7=9A=84=E9=94=99=E8=AF=AF=E7=A0=81=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/hg_scanner.cpp | 2 +- hgdriver/hgdev/hg_scanner_239.cpp | 5 ++++- hgdriver/hgdev/hg_scanner_439.cpp | 7 +++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hgdriver/hgdev/hg_scanner.cpp b/hgdriver/hgdev/hg_scanner.cpp index ba77020..708d2b0 100644 --- a/hgdriver/hgdev/hg_scanner.cpp +++ b/hgdriver/hgdev/hg_scanner.cpp @@ -771,8 +771,8 @@ void hg_scanner::thread_handle_image_process(void) catch (...) { VLOG_MINI_1(LOG_LEVEL_FATAL, "FATAL: Insufficient memory when proecss image with %d bytes.\n", tiny_buffer->size()); - stop(); status_ = SCANNER_ERR_INSUFFICIENT_MEMORY; + stop(); break; } } diff --git a/hgdriver/hgdev/hg_scanner_239.cpp b/hgdriver/hgdev/hg_scanner_239.cpp index 224f930..f49cf60 100644 --- a/hgdriver/hgdev/hg_scanner_239.cpp +++ b/hgdriver/hgdev/hg_scanner_239.cpp @@ -1498,7 +1498,10 @@ void hg_scanner_239::thread_handle_usb_read(void) } if (user_cancel_) { - status_ = ret = SCANNER_ERR_USER_CANCELED; + if (status_) // thread_handle_image_process maybe call stop() when insufficient memory occurs . + ret = status_; + else + status_ = ret = SCANNER_ERR_USER_CANCELED; //VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "用户取消操作 '%s'\n", hg_scanner_err_name(status_)); VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\347\224\250\346\210\267\345\217\226\346\266\210\346\223\215\344\275\234 '%s'\n", hg_scanner_err_name(status_)); auoto_paper_indx = 0; diff --git a/hgdriver/hgdev/hg_scanner_439.cpp b/hgdriver/hgdev/hg_scanner_439.cpp index 4bd4cdc..c99cbc7 100644 --- a/hgdriver/hgdev/hg_scanner_439.cpp +++ b/hgdriver/hgdev/hg_scanner_439.cpp @@ -1373,8 +1373,11 @@ void hg_scanner_439::thread_handle_usb_read(void) } if (user_cancel_) { - status_ = ret = SCANNER_ERR_USER_CANCELED; - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "用户取消操作 '%s'\n", hg_scanner_err_name(status_)); + if (status_) // thread_handle_image_process maybe call stop() when insufficient memory occurs . + ret = status_; + else + status_ = ret = SCANNER_ERR_USER_CANCELED; + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\347\224\250\346\210\267\345\217\226\346\266\210\346\223\215\344\275\234 '%s'\n", hg_scanner_err_name(status_)); break; } if (count == 0)