Skip to content

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

Description

@pleprince

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions