[tests] BitmapContextTest.AdaptiveTest to not crash.#24500
Conversation
1. Split the AdaptiveTest into 4 different tests to make it easier to figure out where crashes occur. 2. Use autorelease pools to have more consistent memory management. This means the OnReleaseInfo callbacks will be called during the test, so adjust accordingly. 3. Create a CGRenderingBufferProvider in OnAllocate callbacks. This seems to be what fixes the crash. This also makes it so that the calls to CGBitmapContext.ToImage() succeed, so adjust accordingly.
There was a problem hiding this comment.
Pull request overview
This PR fixes crashes in the BitmapContextTest.CreateAdaptive test by splitting it into 4 isolated tests, introducing autorelease pools for deterministic memory management, and properly creating CGRenderingBufferProvider instances in the OnAllocate callbacks.
Changes:
- Split single
CreateAdaptivetest into 4 separate tests (CreateAdaptive_1throughCreateAdaptive_4) to isolate test scenarios and make crash locations more identifiable - Wrapped test code in
NSAutoreleasePoolusing blocks to ensure consistent memory management and callback invocation timing - Modified
OnAllocatecallbacks to create and returnCGRenderingBufferProviderinstances instead of returningnull, which fixes the crashes and allowsToImage()calls to succeed
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #8c945c2] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #8c945c2] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
✅ [CI Build #8c945c2] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #8c945c2] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #8c945c2] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #8c945c2] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [CI Build #8c945c2] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💻 [CI Build #8c945c2] Tests on macOS arm64 - Mac Tahoe (26) passed 💻✅ All tests on macOS arm64 - Mac Tahoe (26) passed. Pipeline on Agent |
🚀 [CI Build #8c945c2] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 119 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Split the AdaptiveTest into 4 different tests to make it easier to figure out
where crashes occur.
Use autorelease pools to have more consistent memory management. This means
the OnReleaseInfo callbacks will be called during the test, so adjust accordingly.
Create a CGRenderingBufferProvider in OnAllocate callbacks. This seems to be
what fixes the crash. This also makes it so that the calls to CGBitmapContext.ToImage()
succeed, so adjust accordingly.