Repository navigation
Conversation
This was referenced Nov 1, 2026
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Issue: closes #25863 (fixed on master by eb508ad in #23924; this adds its regression test)
PR Type:
💬 Other: test only (a regression test for a bug that master already fixed)
What changed? 🚀
On Skia Win32 (Windows desktop), when an external drag enters the window,
DragEnterinWin32DragDropExtension.DropTarget.csreads each standard format offered asTYMED_HGLOBALwithIDataObject::GetData, passes the handles toWin32ClipboardExtension.ReadContentIntoPackage, and releases every medium (ReleaseStgMedium) before it returns. A format reader must therefore copy its data beforeReadContentIntoPackagereturns.The CF_DIB reader,
GetBitmap, used to break that rule: it registered a data provider that kept the rawHGLOBALand only locked it when the app calledDataPackageView.GetBitmapAsync(), typically from itsDragOverorDrophandler. The handle was usually freed by then, soGetBitmapAsyncthrew for the Bitmap format of any CF_DIB drag.eb508ad (in #23924, a RichEditBox feature PR) changed
GetBitmapto build the BMP (the DIB behind a file header) and callpackage.SetBitmapbefore returning, which fixed the bug on master. It came without a test, so nothing stops the lazy reader from coming back.servicing/6.8still has the bug; #25865 backports the fix.This PR adds
Given_Win32DragDrop.When_Bitmap_Drop_Read_After_Medium_Released, in the style of the other tests in that class:BI_RGBCF_DIB in aGMEM_MOVEABLEHGLOBAL;ReadContentIntoPackagewith it through reflection;GlobalFree, which is whatReleaseStgMediumdoes for anHGLOBALmedium withoutpUnkForRelease, and checks that the free succeeded;GetBitmapAsyncand checks the stream: a 14-byteBITMAPFILEHEADERstarting withBM, whosebfSizeis the stream's length and whosebfOffBitsis 54, followed by the DIB bytes unchanged.The test reads the bitmap once. Reading it twice, for example in
DragOverand again inDrop, depends on theRandomAccessStreamReference.CreateFromStreamfix in #25867.No product code changes.
Tests: on Skia Desktop (Windows),
Given_Win32DragDrop:When_Bitmap_Drop_Read_After_Medium_ReleasedGiven_Win32DragDroptestsGetBitmaplocally reverted to the lazy data providerWith the lazy reader,
GetBitmapAsyncthrowsInvalidOperationException("Failed to asynchronously load the data of id 'Bitmap'") with an innerTaskCanceledException, becauseDataPackageswallows the provider's error: it logs it ("GlobalLock failed: The handle is invalid.") and completes the request without data.PR Checklist ✅
Screenshots Compare Test Runresults.