Skip to content

Fix: Reset is_concealed_ in ThreadedImageDecoderProxy::Resume()#9218

Open
msolianko wants to merge 1 commit intoyoutube:25.lts.1+from
msolianko:fix_image_preview_load
Open

Fix: Reset is_concealed_ in ThreadedImageDecoderProxy::Resume()#9218
msolianko wants to merge 1 commit intoyoutube:25.lts.1+from
msolianko:fix_image_preview_load

Conversation

@msolianko
Copy link
Collaborator

ThreadedImageDecoderProxy::Conceal() sets is_concealed_ = true, which causes Finish() to silently return without posting the decode-complete task to the load thread. This flag was never reset, so after any Blur→Conceal→Freeze→Unfreeze→Resume lifecycle cycle, all existing image loaders would permanently fail to complete — Loader::LoadComplete() would never be called and the image would never display.

The fix resets is_concealed_ to false in Resume() before re-initializing the underlying ImageDecoder, restoring normal Finish() behavior for loaders that survive a conceal/resume cycle.

@github-actions
Copy link
Contributor

🤖 Gemini Suggested Commit Message


cobalt: Fix image loader after conceal/resume

The ThreadedImageDecoderProxy::is_concealed_ flag was not reset in
Resume() after being set to true by Conceal(). This prevented Finish()
from posting the decode-complete task, causing image loaders to
permanently fail to display images after a conceal/resume cycle.

Reset the is_concealed_ flag in Resume() to restore normal decode
completion and ensure images display correctly.

Bug: 9218

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly fixes a bug where image loaders would fail after a conceal/resume cycle by resetting the is_concealed_ flag. The fix is logical and well-implemented. I have provided one suggestion to further improve the code by using std::atomic<bool> for the flag, which would simplify the thread synchronization logic and be slightly more performant.

Comment on lines +134 to +137
{
base::AutoLock auto_lock(conceal_lock_);
is_concealed_ = false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For a simple boolean flag like is_concealed_, using std::atomic<bool> is generally more efficient and can lead to simpler code than using a base::Lock. This avoids the overhead of lock acquisition and release.

If you change is_concealed_ to be a std::atomic<bool> and remove conceal_lock_, this entire block can be simplified to a single atomic store. This would also require updating other accesses to is_concealed_ (e.g., in Conceal() and Finish()) to use atomic operations instead of the lock.

  is_concealed_ = false;

@msolianko msolianko force-pushed the fix_image_preview_load branch from 2e4fd1b to 56af9e6 Compare February 24, 2026 12:30
@amurovanyi amurovanyi requested a review from kaidokert February 24, 2026 16:11
The ThreadedImageDecoderProxy::is_concealed_ flag was not reset in
Resume() after being set to true by Conceal(). This prevented Finish()
from posting the decode-complete task, causing image loaders to
permanently fail to display images after a conceal/resume cycle.

Reset the is_concealed_ flag in Resume() to restore normal decode
completion and ensure images display correctly.
@msolianko msolianko force-pushed the fix_image_preview_load branch from 56af9e6 to e338ca3 Compare February 26, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants