调整pop_first_image调用位置,避免死锁

This commit is contained in:
gb 2023-05-24 17:16:23 +08:00
parent 5f078d3a77
commit 95ac953da3
1 changed files with 4 additions and 1 deletions

View File

@ -543,6 +543,7 @@ int hg_scanner_302::read_one_image_from_usb(SANE_Image_Statu statu)
total = get_front_data_size(), total = get_front_data_size(),
off = 0, off = 0,
ret = SCANNER_ERR_OK; ret = SCANNER_ERR_OK;
bool popimg = false;
VLOG_MINI_1(LOG_LEVEL_ALL, "New image size: %u\n", total); VLOG_MINI_1(LOG_LEVEL_ALL, "New image size: %u\n", total);
if (!waiting_for_memory_enough(total)) if (!waiting_for_memory_enough(total))
@ -600,7 +601,7 @@ int hg_scanner_302::read_one_image_from_usb(SANE_Image_Statu statu)
ret = save_usb_data(buf); ret = save_usb_data(buf);
if (ret == SCANNER_ERR_OK) if (ret == SCANNER_ERR_OK)
{ {
pop_first_image(); popimg = true;
} }
else else
{ {
@ -617,6 +618,8 @@ int hg_scanner_302::read_one_image_from_usb(SANE_Image_Statu statu)
VLOG_MINI_1(LOG_LEVEL_FATAL, "write command SR_IM_TX failed: %s\n", hg_scanner_err_name(ret)); VLOG_MINI_1(LOG_LEVEL_FATAL, "write command SR_IM_TX failed: %s\n", hg_scanner_err_name(ret));
} }
} }
if(popimg)
pop_first_image();
return ret; return ret;
} }