Skip to content

Break compatibility and depend on GExiv2 >= 0.16#30

Open
jmibanez wants to merge 2 commits into
felixc:mainfrom
jmibanez:main
Open

Break compatibility and depend on GExiv2 >= 0.16#30
jmibanez wants to merge 2 commits into
felixc:mainfrom
jmibanez:main

Conversation

@jmibanez

@jmibanez jmibanez commented Jul 4, 2026

Copy link
Copy Markdown

GExiv2 0.15 breaks API/ABI compatibility[1] by effectively removing the gexiv_metadata methods that internally handled errors and replacing them with what used to be the *_try variants which expect callers to handle errors themselves. Because those variants have an additional argument **GError, calling the library without passing the last argument triggers a segfault when the library method attempts to deref garbage from the stack or register.

Additionally, GExiv2 0.16 removed the actually-deprecated _free() functions (it's been marked deprecated since 0.10.3), with the expectation that callers are already using g_object_unref. However, we can't directly call g_object_unref from the gobject-sys FFI, since that depends on a different type than us. So, add the glue code here to still allow safely freeing GExiv2Metadata and GExiv2PreviewImage.

Since we can't define FFIs with optional args, we need to bite the bullet and just add the extra arg in the relevant methods. To make sure this is restricted to only 0.16, enforce this when looking up gexiv2 from pkg-config.

This is a breaking ABI change. I'm not sure if you'd like to bump the MV for the project (i.e. to publish this PR in gexiv-sys 2.0), so opening the PR for discussion.


[1] https://gitlab.gnome.org/GNOME/gexiv2/-/commit/e05fa4a33ead95d56a5a63cec97d8ed6b1c9cecd
[2] https://gitlab.gnome.org/GNOME/gexiv2/-/commit/560c9223bf9244823e7d120053d6e87668005623

jmibanez added 2 commits July 5, 2026 06:21
GExiv2 0.15 breaks API/ABI compatibility[1] by effectively removing
the gexiv_metadata methods that internally handled errors and
replacing them with what used to be the *_try variants which expect
callers to handle errors themselves. Because those variants have an
additional argument **GError, calling the library without passing the
last argument triggers a segfault when the library method attempts to
deref garbage from the stack or register.

Additionally, GExiv2 0.16 removed the actually-deprecated _free()
functions (it's been marked deprecated since 0.10.3), with the
expectation that callers are already using g_object_unref. However, we
can't directly call g_object_unref from the gobject-sys FFI, since
that depends on a different type than us. So, add the glue code here
to still allow safely freeing GExiv2Metadata and GExiv2PreviewImage.

Since we can't define FFIs with optional args, we need to bite the
bullet and just add the extra arg in the relevant methods. To make
sure this is restricted to only 0.16, enforce this when looking up
gexiv2 from pkg-config.

---
[1] https://gitlab.gnome.org/GNOME/gexiv2/-/commit/e05fa4a33ead95d56a5a63cec97d8ed6b1c9cecd
[2] https://gitlab.gnome.org/GNOME/gexiv2/-/commit/560c9223bf9244823e7d120053d6e87668005623
GExiv2 0.16 actually installs the pkg-config file `gexiv2-0.16.pc`
which means that it actually names itself `gexiv2-0.16`. So, probe for
it explicitly.
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.

1 participant