mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 09:10:48 +01:00
[python] Fix gc_collect to be sure to get unaligned pointers
This commit is contained in:
@@ -8,7 +8,12 @@ static Turtle sTurtle;
|
||||
|
||||
void modturtle_gc_collect() {
|
||||
// Mark the shared sTurtle object as a GC root
|
||||
gc_collect_root((void **)&sTurtle, sizeof(Turtle)/sizeof(void *));
|
||||
for (size_t i = 0; i < sizeof(void *); i++) {
|
||||
// See comment in port.cpp: gc_collect implementation
|
||||
char * turtleWithOffset = (char *)&sTurtle + i;
|
||||
size_t turtleLengthInAddressSize = (sizeof(Turtle) - i + sizeof(void *) - 1)/sizeof(void *);
|
||||
gc_collect_root((void **)turtleWithOffset, turtleLengthInAddressSize);
|
||||
}
|
||||
}
|
||||
|
||||
void modturtle_view_did_disappear() {
|
||||
|
||||
Reference in New Issue
Block a user