diff --git a/sane/scanner.cpp b/sane/scanner.cpp index a8081e4..9f5d4cf 100644 --- a/sane/scanner.cpp +++ b/sane/scanner.cpp @@ -784,6 +784,7 @@ void scanner::on_ui_event(int uev, void* sender) indicator_.reset(); is_scanning_ = is_show_setting_; + ui_notify = std::function(); } 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) { is_scanning_ = is_show_setting_; + ui_notify = std::function(); } 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 ... // #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; @@ -3265,6 +3267,7 @@ COM_API_IMPLEMENT(scanner, void, ui_hide(void)) if (callback::close_ui) callback::close_ui(UI_INDICATOR | UI_SETTING | UI_MSG_BOX); is_show_setting_ = false; + ui_notify = std::function(); } COM_API_IMPLEMENT(scanner, bool, ui_is_ok(void)) {