Bug: Segfaults appearing with "QObject::setParent: Cannot set parent, new parent is in a different thread"
See original GitHub issueš Bug
In the last couple days, Iāve seen this segfault a couple times on main. Iām not quite sure whatās causing it yet, but it tends to happen with mouse movements, perhaps on the canvas, maybe on sliders, not sure⦠but it crashes napari out to the console
WARNING: QObject::setParent: Cannot set parent, new parent is in a different thread
10:19:54 WARNING QObject::setParent: Cannot set parent, new parent is in a different thread
WARNING: QObject::setParent: Cannot set parent, new parent is in a different thread
10:19:54 WARNING QObject::setParent: Cannot set parent, new parent is in a different thread
WARNING: QObject::setParent: Cannot set parent, new parent is in a different thread
10:19:54 WARNING QObject::setParent: Cannot set parent, new parent is in a different thread
[1] 19897 segmentation fault napari
Issue Analytics
- State:
- Created a year ago
- Comments:20 (18 by maintainers)
Top Results From Across the Web
Cannot set parent, new parent is in a different thread in Python ...
I am facing a problem with the GUI I developed using PyQt5 . The app tries to update the value of a progress...
Read more >QObject::setParent: Cannot set parent, new parent is in a ...
SOLVED QObject::setParent: Cannot set parent, new parent is in a different thread Segmentation fault ... i am working on new project with combinesĀ ......
Read more >setParent: Cannot set parent, new parent is in a different thread
Hi, everyone. I've created this plugin to sync calibre library and Skoob (a book social network, similar to GoodReads).
Read more >QObject::setParent across threads. - Qt Centre Forum
Cannot send events to objects owned by a different thread. ... Furthermore objects can't have a parent that lives in a diffrent thread...
Read more >Debugging Segmentation Faults and Pointer Problems
For new programmers, debugging errors associated with pointers can be a nightmare. "Segmentation Fault (core dumped)" is a pretty vague error message,Ā ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I donāt think exact issue ever made into an official release as it should have been fixed between the release of v0.4.16 and v0.4.17 (first in https://github.com/napari/napari/pull/4983 then in https://github.com/napari/napari/pull/4985).
The goal of https://github.com/napari/napari/pull/5195 was to add some tooling to better detect when this happens, but itās only available on
main
(i.e. not on v0.4.17). If youāre developing againstmain
, then you can setNAPARI_ENSURE_PLUGIN_MAIN_THREAD=1
to get more info about where this is happening in your code.Generally, napari is not thread safe, so I would only update a layer on the main thread unless some napari documentation says otherwise. If you can directly depend on
superqt
(the full napari viewer does), then you can use theensure_main_thread
decorator to ensure that a particular function/callback executes on the qt main thread.If you still have problems, you might want to create a separate issue with the details.
yeah, that seems like a good plan to me. āupdate status barā is a strictly gui related thing, so that should probably have been on the
_qt
side of things all along