clear ui_notify when finished or close ui

This commit is contained in:
gb 2023-05-29 14:50:17 +08:00
parent 154214e426
commit f23a7689c6
1 changed files with 4 additions and 1 deletions

View File

@ -784,6 +784,7 @@ void scanner::on_ui_event(int uev, void* sender)
indicator_.reset(); indicator_.reset();
is_scanning_ = is_show_setting_; is_scanning_ = is_show_setting_;
ui_notify = std::function<void(int, void*, int)>();
} }
else if (uev == SANE_EVENT_UI_CLOSE_CANCEL) else if (uev == SANE_EVENT_UI_CLOSE_CANCEL)
{ {
@ -796,6 +797,7 @@ void scanner::on_ui_event(int uev, void* sender)
else if (uev == SANE_EVENT_SCAN_FINISHED) else if (uev == SANE_EVENT_SCAN_FINISHED)
{ {
is_scanning_ = is_show_setting_; is_scanning_ = is_show_setting_;
ui_notify = std::function<void(int, void*, int)>();
} }
int(__stdcall * h)(int, void*) = scanner_ev_handler_; int(__stdcall * h)(int, void*) = scanner_ev_handler_;
@ -1422,7 +1424,7 @@ int scanner::thread_start(void)
// display error message on progress UI, may be closed immediately by APP, so we hide progress UI and call message_box ... // display error message on progress UI, may be closed immediately by APP, so we hide progress UI and call message_box ...
// //
#ifdef START_SCAN_IN_THREAD #ifdef START_SCAN_IN_THREAD
if (callback::show_progress_ui && is_bIndicator) if (callback::show_progress_ui && is_bIndicator && ui_notify)
{ {
int ev = SANE_EVENT_WORKING; int ev = SANE_EVENT_WORKING;
@ -3265,6 +3267,7 @@ COM_API_IMPLEMENT(scanner, void, ui_hide(void))
if (callback::close_ui) if (callback::close_ui)
callback::close_ui(UI_INDICATOR | UI_SETTING | UI_MSG_BOX); callback::close_ui(UI_INDICATOR | UI_SETTING | UI_MSG_BOX);
is_show_setting_ = false; is_show_setting_ = false;
ui_notify = std::function<void(int, void*, int)>();
} }
COM_API_IMPLEMENT(scanner, bool, ui_is_ok(void)) COM_API_IMPLEMENT(scanner, bool, ui_is_ok(void))
{ {