Repository navigation
Conversation
Port of unoplatform#25555 (43b47f5), the 6.8 backport of unoplatform#25166. On Skia, SetSourceAsync(stream) returned Other and drew nothing, and neither Opened nor OpenFailed fired, whether Image.Source was set before or after the call. SetSourceAsync subscribes to the source, which opens it, then calls InvalidateSource, which opens it again and cancels the first open's token, and the cached load was bound to that token. An ImageBrush that subscribes while a UriSource is still loading re-opens it the same way. - The load has its own cancellation, cancelled only when the source itself changes (UnloadImageSourceData), as on master and as in WinUI, where only DisconnectImageOperation aborts a decode. - Tests: When_SVGImageSource_SetSourceAsync_File_Stream, When_SVGImageSource_SetSourceAsync_Twice (Given_Image) and When_SvgImageSource_Assigned_While_Opening (Given_ImageBrush). 6.8 differences: - None: unoplatform#25555 targets servicing/6.8 and cherry-picks clean, also on top of the unoplatform#25124 port. That port leaves an SvgImageSource's data alone while nothing subscribes, so the load this keeps alive is not released under it.
On Skia, SetSourceAsync(stream) returned Other and drew nothing, and neither Opened nor OpenFailed fired, whether Image.Source was set before or after the call. SetSourceAsync subscribes to the source, which opens it, then calls InvalidateSource, which opens it again and cancels the first open's token. The load is cached in _currentOpenTask and was bound to that first token, so the second open reused a load whose stream read had been cancelled. An ImageBrush that subscribes to an SvgImageSource whose UriSource is still loading re-opens it the same way. The load now has its own cancellation, cancelled only when the source itself changes (UnloadImageSourceData), as on master since unoplatform#25166 and as in WinUI, where only DisconnectImageOperation aborts a decode.
43b47f5 to
2201a6c
Compare
|
@mikernet heads-up: I rebased this branch onto the current The only conflict was in After the rebase, |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 244747 did not find any UI Test snapshots differences. |
|
Tick the box to add this pull request to the merge queue (same as
|
MartinZikmund
left a comment
There was a problem hiding this comment.
Thanks @mikernet! I checked this against #25166: the provider change is the same fix, adapted correctly to 6.8's layout (provider + .skia.cs, with the Android/Apple partials only picking up the new signature), and it doesn't use anything that's master-only. The CI failures (Given_InputInjector, Given_TextBox touch, Given_CommandBar) aren't in the SVG/image area, so they're unrelated.
One optional nit: When_SvgImageSource_Assigned_While_Opening uses Include SkiaDesktop | SkiaMobile, which also skips it on WinAppSDK. Excluding only SkiaWasm, as the master test does, would keep the WinUI parity run.
The test only needs sockets, so it now excludes the browser (and the native renderers, like its siblings) instead of including only Skia desktop and mobile, which also skipped WinAppSDK.
|
Done in 0be5cf9: |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 249303 did not find any UI Test snapshots differences. |
GitHub Issue: closes #25554
PR Type:
🐞 Bugfix
What changed? 🚀
This backports #25166 to
servicing/6.8, adapted to 6.8'sISvgProviderlayout. It is the bug fix only. The differences from WinUI that I found while testing this are present on master too, so they go to master in #25558.On Skia,
SvgImageSource.SetSourceAsync(stream)returnedOtherand drew nothing, and neitherOpenednorOpenFailedwas raised. It failed whetherImage.Sourcewas set before or after the call.SetSourceAsyncsubscribes to the source, which opens it, and then callsInvalidateSource(), which opens it again and cancels the first open's token. The load cached in_currentOpenTaskwas bound to that first token, so the second open reused a load whose stream read had been cancelled. AnImageBrushthat subscribes to anSvgImageSourcewhile itsUriSourceis still loading re-opens it the same way and stayed empty.As in #25166, the load now has its own
CancellationTokenSource. OnlyUnloadImageSourceData, called when the source itself changes, cancels it. This matches WinUI, where onlyDisconnectImageOperationaborts a decode. A load aborted that way returns empty without publishing. The native Android and Apple partials share the provider, so I only updated their calls to the new signature.Tests:
Given_Image.When_SVGImageSource_SetSourceAsync_File_Stream, withImage.Sourceset before and after the call: the status isSuccess,Openedis raised and the SVG is drawn. The stream comes from a file, so its read is still pending when the source is opened again.Given_Image.When_SVGImageSource_SetSourceAsync_Twice: twoSetSourceAsynccalls on the same source, red and then blue, and each color is drawn.Given_ImageBrush.When_SvgImageSource_Assigned_While_Opening: a loopback server answers after 200 ms, so the brush subscribes while the source is still opening. It is excluded on WebAssembly, where the browser has no sockets, and on the native Android and iOS renderers, like the stream tests. It runs on WinUI, as master'sGiven_Imageversion does.Given_Imagetests are excluded on the native renderers, which load SVG through their own pipeline.Results:
Other. On Skia desktop, the source-after row and the twice test failed in all 3 runs, the source-first row in 1 of 3 (the file read races the second open), and the brush test in 2 of 2.Given_Image,Given_ImageSource,Given_ImageBrushandGiven_BitmapSourcepass on Skia desktop (61/61, Win32). On Skia WebAssembly,Given_Image,Given_ImageBrushandGiven_BitmapSourcepass 60/60, plus 1 inconclusive (When_Transitive_Asset_With_Link_Loaded).Given_Imagetests pass on WinUI (WinAppSDK).Uno.UIcompiles fornet10.0-androidandnet10.0-ios26.0.PR Checklist ✅
Screenshots Compare Test Runresults.