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

Use a scoped proj logger to avoid user data lifetime issues (backport) #59087

Merged
merged 3 commits into from
Oct 17, 2024

Conversation

nyalldawson
Copy link
Collaborator

Manual backport of #59080

(cherry picked from commit 97c5f95)
Previously we incorrectly tried to reset the proj logger by
calling proj_log_func with a nullptr function in some exit
paths. This leads to crashes, as the nullptr arg makes
proj_log_func a no-op, and then later proj tries to
log using the now destroyed user data string list.

Make all this more robust by switching to a scoped
QgsScopedProjCollectingLogger class, which automatically
correctly restores the default QGIS proj logger
on destruction and ensures there's no object lifetime
issues for the log function vs the user data object.

Fixes qgis#36125, other crashes seen in the wild

(cherry picked from commit 244da7a)
@nyalldawson nyalldawson added Backport Is a backport of another pull request Crash/Data Corruption labels Oct 15, 2024
@github-actions github-actions bot added this to the 3.35.0 milestone Oct 15, 2024
@nyalldawson nyalldawson reopened this Oct 16, 2024
@nyalldawson nyalldawson merged commit 5471ff2 into qgis:release-3_34 Oct 17, 2024
60 of 61 checks passed
@nyalldawson nyalldawson deleted the backport_59080 branch October 17, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport Is a backport of another pull request Crash/Data Corruption
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants