-
Notifications
You must be signed in to change notification settings - Fork 59
[Bug Fix] Fix Shape + fill color mismatch issue #777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // | ||
| // interpose.c | ||
| // SharedExample | ||
| // | ||
| // Created by Kyle on 2025/10/3. | ||
| // | ||
|
|
||
| #include <stdbool.h> | ||
| #include <stdint.h> | ||
| #include <dlfcn.h> | ||
| #include <AttributeGraph/AttributeGraph-umbrella.h> | ||
|
|
||
| // Forward declare the original | ||
| extern bool kdebug_is_enabled(uint32_t debugid); | ||
|
|
||
| // Our replacement | ||
| static bool my_kdebug_is_enabled(uint32_t debugid) { | ||
| return true; | ||
| } | ||
|
|
||
| extern const void *$s15OpenSwiftUICore5ColorV8ResolvedVN; | ||
|
|
||
| const void *_OpenSwiftUI_ColorResolvedNTD(void) { | ||
| return &$s15OpenSwiftUICore5ColorV8ResolvedVN; | ||
| } | ||
|
|
||
| extern bool swift_dynamicCast(void *dest, void *src, | ||
| const void *srcType, | ||
| const void *targetType, | ||
| uint64_t flags); | ||
|
|
||
| static bool my_swift_dynamicCast(void *dest, void *src, const void *srcType, const void *targetType, uint64_t flags) { | ||
| CFStringRef target_description = AGTypeDescription((AGTypeID)targetType); | ||
| // Check if target_description contains "Color.Resolved" | ||
| if (target_description != NULL) { | ||
| CFRange range = CFStringFind(target_description, CFSTR("Color.Resolved"), 0); | ||
| if (range.location != kCFNotFound) { | ||
| // First try the original cast, if it fails try with OpenSwiftUI's Color.Resolved | ||
| return swift_dynamicCast(dest, src, srcType, targetType, flags) || | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because Severity: high 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||
| swift_dynamicCast(dest, src, srcType, _OpenSwiftUI_ColorResolvedNTD(), flags); | ||
| } | ||
| } | ||
| return swift_dynamicCast(dest, src, srcType, targetType, flags); | ||
| } | ||
|
|
||
| // Interpose using Mach-O section | ||
| typedef struct interpose_s { | ||
| const void *replacement; | ||
| const void *original; | ||
| } interpose_t; | ||
|
|
||
| __attribute__((used)) static const interpose_t interposers[] | ||
| __attribute__((section("__DATA, __interpose"))) = { | ||
| // Interpose kdebug_is_enabled to always return true to perform Signpost testing with Instruments | ||
| { (const void *)my_kdebug_is_enabled, (const void *)kdebug_is_enabled }, | ||
| // Interpose swift_dynamicCast to handle casts to SwiftUI's internal Color.Resolved type to fix SwiftUI.ShapeLayerHelper visit check for Shape.fill API | ||
| { (const void *)my_swift_dynamicCast, (const void *)swift_dynamicCast }, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interposing Severity: medium 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||
| }; | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exception set marks
interpose.cas amembershipExceptionfor theTestingHosttarget, even thoughOpenSwiftUIUITestsusesTestingHost.appasTEST_HOST. Please verify the interposer is actually present in the host process where the shape rendering/casts occur.Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.