Skip to content

Commit

Permalink
Merge pull request #209 from ThinBridge/fix-print-system-dialog-freez…
Browse files Browse the repository at this point in the history
…e-14.1.119.0

[v14.1.119.0][Message Loop]: try to execute remaining works only on not being active
  • Loading branch information
HashidaTKS authored Jun 26, 2024
2 parents fd62066 + 1b192c3 commit faec056
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
29 changes: 16 additions & 13 deletions MessageLoopWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void MessageLoopWorker::KillTimer()
}
}

void MessageLoopWorker::DoWork()
bool MessageLoopWorker::PerformMessageLoopWork()
{
if (m_bIsActive_)
{
Expand All @@ -108,20 +108,23 @@ void MessageLoopWorker::DoWork()
// method. If re-entrancy is detected we must repost a request again to the
// owner thread to ensure that the discarded call is executed in the future.
m_bReentrancyDetected_ = true;
return false;
}
else
{
m_bReentrancyDetected_ = false;

m_bIsActive_ = true;
CefDoMessageLoopWork();
m_bIsActive_ = false;

// Note: |m_bReentrancy_detected_| may have changed due to re-entrant calls to
// this method.
}
m_bReentrancyDetected_ = false;

m_bIsActive_ = true;
CefDoMessageLoopWork();
m_bIsActive_ = false;

// Note: |m_bReentrancy_detected_| may have changed due to re-entrant calls to
// this method.
return m_bReentrancyDetected_;
}

if (m_bReentrancyDetected_)
void MessageLoopWorker::DoWork()
{
const bool bWasReentrant = PerformMessageLoopWork();
if (bWasReentrant)
{
// Execute the remaining work as soon as possible.
PostScheduleMessage(0);
Expand Down
1 change: 1 addition & 0 deletions MessageLoopWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class MessageLoopWorker
void KillTimer();
void OnScheduleWork(int64_t delayMs);
void OnTimerTimeout();
bool PerformMessageLoopWork();
void DoWork();
void InitWindow();
static LRESULT CALLBACK WindowProcesser(HWND hwnd,
Expand Down

0 comments on commit faec056

Please sign in to comment.