AcademySoftwareFoundation / AcademySoftwareFoundation/xstudio

Filesystem browser thumbnail fallback: offscreen viewport has no render handler for supplied ImageBufPtr

Open
#337 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
773
Forks
129
Avg merge
9d 1m
Merged PRs (30d)
10

Description

Describe the bug

When the filesystem browser loads thumbnails, two messages appear for media that takes the full-image thumbnail fallback:

*** unexpected message [id: 651, name: user.scheduled-actor]: message(xstudio::ui::viewport::render_viewport_to_image_atom(), 128, 72, xstudio::media_reader::ImageBufPtr)
qrc:/FileSystemBrowser/FileSystemBrowser/xstudio/FSThumbItem.qml:74:21: QML QQuickImage*: Thumbnail does not exist 2.

Affected files show a blank thumbnail, and both messages spam the console / QML output every time such thumbnails are requested.

Root cause (analysis)

MediaDetailAndThumbnailReaderActor::get_thumbnail_from_reader_plugin
(src/media_reader/src/media_detail_and_thumbnail_reader_actor.cpp, around line 210) falls back to reading the full image when a reader can't provide a thumbnail buffer, then asks the offscreen viewport to render it to a thumbnail:

mail(ui::viewport::render_viewport_to_image_atom_v, thumb_width, thumb_height, buf)
    .request(offscreen_renderer, infinite)   // buf = media_reader::ImageBufPtr

OffscreenViewport (src/ui/qt/viewport_widget/src/offscreen_viewport.cpp) has no handler for the (render_viewport_to_image_atom, int, int, ImageBufPtr) signature, so CAF reports the "unexpected message" and the request fails. That failure propagates to the QML thumbnail provider, which reports "Thumbnail does not exist 2." at the FSThumbItem.qml image delegate.

The existing closest handlers take (atom, THUMBNAIL_FORMAT, int, int) or (atom, int, int, ImageFormat) — none accept an ImageBufPtr.

To Reproduce

  1. Open the filesystem browser in thumbnail view.
  2. Browse to a directory containing a media format whose reader's thumbnail() returns a null ThumbnailBufferPtr while its image() still succeeds (i.e. enters the full-image fallback branch).
  3. Observe the two messages above and the blank thumbnails.

Expected behavior

The offscreen viewport should accept the (atom, int, int, ImageBufPtr) message and return a rendered ThumbnailBufferPtr (RGB24), so fallback thumbnails render and neither message is emitted.

Proposed fix

Add a render_viewport_to_image_atom handler to OffscreenViewport::make_behavior that renders the supplied ImageBufPtr at the requested size through the existing colour-managed pipeline (renderToImageBufferRGBA_16Frgb96thumbFromHalfFloatImageconvert_to(TF_RGB24)), with input validation (null buffer / non-positive dimensions return a CAF error instead of dereferencing or creating an invalid FBO size).

Screenshots

N/A — observable via the two console/QML messages above.

Desktop (please complete the following information):

  • OS: Windows 10 (x64), MSVC 2022 build

Additional context

The QML "Thumbnail does not exist 2." is a downstream symptom of the failed viewport request, not an independent provider bug — both disappear once the missing handler exists.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/ui/qt/viewport_widget/src/offscreen_viewport.cpp and inspect OffscreenViewport::make_behavior alongside the existing render_viewport_to_image_atom handlers. Reproduce the filesystem-browser thumbnail case described in the issue, then verify that the ImageBufPtr request returns an RGB24 ThumbnailBufferPtr and that the unexpected-message and QML errors no longer appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.