Closed jlgerber closed 4 years ago
Looks like double free. All the content of the window is owned by it, so when CppBox<QMainWindow>
gets dropped, all containing objects are deleted as well. But CppBox<QActionGroup>
and CppBox<QAction>
will also try to delete their objects, resulting in UB. You should use into_ptr()
on a CppBox
object when you pass ownership of the object elsewhere. In case of QAction::from_q_object
, the constructed object is already owned by its parent, so you should call into_ptr()
on it immediately.
Interesting. ok that worked. I had to call into_ptr on the actions and the actiongroup. I figured that it was a double free, the ownership wasnt clear to me. Normally I call into_ptr() when i transfer ownership to qt (at least that is how i think if it). However, the docs make it sound like i own QAction...
It seems like there is something going on here. When I introduce a QActionGroup, I get a segfault on quit. I don't see what i am doing wrong here, based on the type signatures... I am running on os x using qt version 5.13.2 / 5.14.0
Here is a simple repro: