Skip to content
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

mupdf: fix finalizers #2001

Merged
merged 3 commits into from
Dec 8, 2024
Merged

Conversation

benoit-pierre
Copy link
Contributor

@benoit-pierre benoit-pierre commented Dec 8, 2024

Some of the MuPDF tests segfault on quit pretty regularly (e.g.: make --assume-old=all test T='mupdf -f jbig'), this is because there's no guarantee that the context used to open a document or page won't be dropped before that document / page is.

Use the context private user pointer to keep a reference count and ensure it's only dropped last.


This change is Reviewable

Some of the MuPDF tests segfault on quit pretty regularly (e.g.:
`make --assume-old=all test T='mupdf -f jbig'`), this is because
there's no guarantee that the context used to open a document or
page won't be dropped before that document / page is.

Use the context private user pointer to keep a reference count and
ensure it's only dropped last.
Use a weak reference to allow for garbage collection.
@benoit-pierre benoit-pierre force-pushed the pr/fix_mupdf_finalizers branch from 26a34c6 to 06e7f2c Compare December 8, 2024 10:05
Copy link
Member

@NiLuJe NiLuJe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat and elegant ;).

:lgtm:

@Frenzie Frenzie merged commit 3e3c768 into koreader:master Dec 8, 2024
4 checks passed
@benoit-pierre benoit-pierre deleted the pr/fix_mupdf_finalizers branch December 8, 2024 16:02
Frenzie added a commit to koreader/koreader that referenced this pull request Dec 11, 2024
Includes:

* sqlite: update to 3.47.2 (koreader/koreader-base#1999)
* mupdf: fix finalizers (koreader/koreader-base#2001)
* mupdf: allow memory streams to load resources (koreader/koreader-base#2002) for #12877
* thirdparty/lua-Spore 0.3.4 (koreader/koreader-base#2003)
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.

3 participants