https://bugs.kde.org/show_bug.cgi?id=528656

Jack Hill <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Latest Commit|                            |https://invent.kde.org/game
                   |                            |s/libkdegames/-/commit/d3e4
                   |                            |7ac72efed1c64d24992e4de586a
                   |                            |8cbb1a2ea
            Version|                            |26.12.0
  Fixed/Implemented|                            |
                 In|                            |
         Resolution|---                         |FIXED

--- Comment #10 from Jack Hill <[email protected]> ---
Git commit d3e47ac72efed1c64d24992e4de586a8cbb1a2ea by Jack Hill, on behalf of
George Gaidarov.
Committed on 22/11/2026 at 12:58.
Pushed by jackh into branch 'master'.

KGameItem: never render sprites synchronously on the GUI thread

KGameItem is two nested Images: an asynchronous, invisible backend that
requests the sprite from KGameImageProvider, and a synchronous frontend that is
given the backend's source once that has been loaded, so that it can be shown
from QQuickPixmapCache without flicker.

The backend's onSourceChanged handler broke this. QQuickImageBase emits
sourceChanged() before it starts loading the new source, so inside the handler
"status" still describes the previous source. When that one was Ready (e.g. a
cache hit for an intermediate size of a freshly created item), the handler
copied a URL that had not been rendered yet to the frontend. Being synchronous,
the frontend then rendered it on the GUI thread, through the same QSvgRenderer
that the QQuickPixmapReader thread was using at that moment.

QSvgRenderer is not thread-safe: QtSvg keeps per-element state (e.g.
QSvgTransformStyle's saved world transforms) in the document while drawing. In
KNetWalk, the GUI and loader threads drew the same element (its computer icons)
and showed mis-sized sprites, white backgrounds, "qt.svg.draw: Shape of type 10
ignored" warnings and glibc heap corruption aborts.

The handler is not needed either: QQuickImageBase resets the status to Null
before each load, so a cache hit still emits statusChanged() and
onStatusChanged already updates the frontend. Remove it. The handler also
cleared the frontend when the source became empty (no key, zero size), because
the stale status was usually Ready. Keep that by also copying the source when
the status becomes Null, which only happens for an empty source.

Also build the URL from width/height in a single binding. The separate "size"
property could still hold its old value when "source" was re-evaluated, which
produced requests such as ".../0x0" or ".../175x0". The provider renders those
at the element's natural size, and the result was discarded right away.
Related: bug 486016, bug 514486
FIXED-IN: 26.12.0

M  +12   -7    src/qml/qml/KGameItem.qml

https://invent.kde.org/games/libkdegames/-/commit/d3e47ac72efed1c64d24992e4de586a8cbb1a2ea

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to