Skip to content

Conversation

@tleedjarv
Copy link
Contributor

Details in the commit message and in the code comment.

It is not possible to use [GdkPixbuf.get_pixels] as it will crash on
64-bit Windows. It is not possible to use [GdkPixbuf.from_data] with
most backing buffers (for example those based on string/bytes) as GC
may cause those to move around in memory, thus breaking the pixbuf.

The current assumption is that due to the implementation of [Bigarray]
its data buffer is allocated in C and not moved around by GC, thus
suitable to use with [GdkPixbuf.from_data]. However, as a trade-off,
creating a [Gpointer.region] based on a [Bigarray] does make this code
dependent on internal implementation details of [Bigarray].

This patch uses a custom function for creating a [Gpointer.region] of a
[Bigarray] as [Gpointer.region_of_bigarray] is even more tightly bound
to internal implementation details of [Bigarray].
@gdt gdt merged commit 1cdd0ec into bcpierce00:master Nov 1, 2024
28 checks passed
@gdt gdt mentioned this pull request Nov 1, 2024
@tleedjarv tleedjarv deleted the fix-pixbuf-segv branch November 2, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants