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

Segmentation fault if the application is exited while the job is running #261

Open
KitsuneRal opened this issue Jan 28, 2025 · 2 comments
Open

Comments

@KitsuneRal
Copy link
Contributor

With Qt Keychain 0.14.3, if ReadPasswordJob is running at the moment when the application gets a quit event, the library crashes with on_password_lookup() in libsecret.cpp trying to call (in my case) q->emitFinishedWithError(QKeychain::EntryNotFound) - however, q is pointing to freed memory by then. Perhaps it's worth using QPointer for callbackArg::self and check its validity somewhere around this line.

@frankosterfeld
Copy link
Owner

frankosterfeld commented Jan 28, 2025

The problem I see is that we can pass the QPointer to libsecret and have it manage its lifetime. Looking at the API documentation, I would think we would have to pass a GCancellable and make sure to cancel it when the job is destroyed. This might be easy to trigger by deleting a job just after start.

@frankosterfeld
Copy link
Owner

frankosterfeld commented Feb 7, 2025

I can trigger this by e.g. adding deleteLater() in ReadJobPrivate::scheduledStart(), after triggering the async password lookup. A tried passing a GCancellable during construction and cancel it in the job's dtor, but that didn't work how I expected, the callback is still called by libsecret. Needs more investigation whether I'm holding it wrong, or libsecret not checking whether the cancellable was canceled before calling the callback.

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

No branches or pull requests

2 participants