start时阻塞到有图片返回或者异常结束才返回。fix bug-726
This commit is contained in:
parent
07079f2776
commit
c838a6dc47
|
@ -807,26 +807,23 @@ void scanner::scan_done(void)
|
||||||
else if (ui_notify)
|
else if (ui_notify)
|
||||||
ui_notify(SANE_EVENT_SCAN_FINISHED, &msg[0], err_);
|
ui_notify(SANE_EVENT_SCAN_FINISHED, &msg[0], err_);
|
||||||
else
|
else
|
||||||
is_scanning_ = false;
|
{
|
||||||
//else
|
if (err_)
|
||||||
//{
|
{
|
||||||
// if (err_)
|
if (callback::show_messagebox_ui)
|
||||||
// {
|
{
|
||||||
// if (callback::show_messagebox_ui)
|
callback::show_messagebox_ui(app_wnd_, SANE_EVENT_SCAN_FINISHED, (void*)&msg[0], 0);
|
||||||
// {
|
}
|
||||||
// callback::show_messagebox_ui(app_wnd_, SANE_EVENT_SCAN_FINISHED, (void*)&msg[0], 0);
|
else // windows message box ...
|
||||||
// }
|
{
|
||||||
// else // windows message box ...
|
std::wstring text(local_trans::a2u(msg.c_str(), CP_UTF8));
|
||||||
// {
|
if (!IsWindow(app_wnd_))
|
||||||
// std::wstring text(local_trans::a2u(msg.c_str(), CP_UTF8));
|
callback::bring_message_box_topmost(local_trans::lang_trans_between_hz936(CONST_STRING_ERROR).c_str());
|
||||||
// if (!IsWindow(app_wnd_))
|
MessageBoxW(app_wnd_, text.c_str(), local_trans::lang_trans_between_hz936(CONST_STRING_ERROR).c_str(), MB_OK);
|
||||||
// callback::bring_message_box_topmost(local_trans::lang_trans_between_hz936(CONST_STRING_ERROR).c_str());
|
}
|
||||||
// MessageBoxW(app_wnd_, text.c_str(), local_trans::lang_trans_between_hz936(CONST_STRING_ERROR).c_str(), MB_OK);
|
}
|
||||||
// }
|
on_ui_event(SANE_EVENT_SCAN_FINISHED, (void*)SANE_EVENT_SCAN_FINISHED);
|
||||||
// }
|
}
|
||||||
// on_ui_event(SANE_EVENT_SCAN_FINISHED, (void*)SANE_EVENT_SCAN_FINISHED);
|
|
||||||
//}
|
|
||||||
// is_scanning_ = false;
|
|
||||||
is_in_working_thread_ = false;
|
is_in_working_thread_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2781,12 +2778,15 @@ COM_API_IMPLEMENT(scanner, int, start(void))
|
||||||
user_cancel_ = false;
|
user_cancel_ = false;
|
||||||
fetch_imgs_ = 0;
|
fetch_imgs_ = 0;
|
||||||
is_scanning_ = true;
|
is_scanning_ = true;
|
||||||
|
err_ = SANE_STATUS_GOOD;
|
||||||
app_wnd_ = setting_ ? setting_->hwnd() : callback::find_main_wnd();
|
app_wnd_ = setting_ ? setting_->hwnd() : callback::find_main_wnd();
|
||||||
|
|
||||||
if (thread_starting_.get() && thread_starting_->joinable())
|
if (thread_starting_.get() && thread_starting_->joinable())
|
||||||
thread_starting_->join();
|
thread_starting_->join();
|
||||||
#ifdef START_SCAN_IN_THREAD
|
#ifdef START_SCAN_IN_THREAD
|
||||||
thread_starting_.reset(new std::thread(&scanner::thread_start, this));
|
thread_starting_.reset(new std::thread(&scanner::thread_start, this));
|
||||||
|
get_scanned_images(-1); // block until image arrived or scan finished
|
||||||
|
ret = err_;
|
||||||
#else
|
#else
|
||||||
ret = thread_start();
|
ret = thread_start();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue