-
-
Notifications
You must be signed in to change notification settings - Fork 48
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 when using QObject in Python #85
Comments
Do you call it from a different thread? Can you create a SSCCE to reproduce this issue? Also, on which version / platform / OS are you experiencing this issue? Can you run it in |
I'm attempting to narrow this down to a minimal sample that reproduces it but figured I'd give some info that might be related or might not. I have a translation class that is a QObject that I use for gettext translations. I set it as a context property and use it throughout QML and to allow the same pipeline for Python I used Pyotherside to store the method in Python for use there. QML setting the QObject to find the function from: QML translate function:
main.cpp: translation_service.cpp: In Python I reference the QML method by:
In Python I've created a loop that calls this method repeatedly:
This will crash almost immediately. I'm not sure this is my root problem but it might be a different problem I've found. If I add some time.sleep() calls or don't call it so much it is fine. |
Okay I've finally figured out this issue. Any time I try and access a QObject that's passed into Python I can have it crash. It's not every time though. I'm currently using QObjects in Python for 2 use cases. The first is the translator functionality above where I was storing a QML function to use in Python. The other case was I was passing a Popup window with a cancel property on it and in Python if the user ever set that boolean property to false I would cancel what I was doing in Python. I will create a small project that shows it shortly here. |
Can you get a backtrace of the crash? Using e.g. |
Initial comments were wrong. See later comments.
The text was updated successfully, but these errors were encountered: