Omit panics for pure virtual overrides - #341
Conversation
8882ffe to
ab965da
Compare
|
Awesome work as always - I love the unit tests (and they're probably fine where they are for now). This turned out to be a really simple patch. I don't think i quite get the mechanism though - is that all there is to it, just skip the ok checks for those methods? Why does that work, why doesn't the A Miqt And it shouldn't pass the check, since So how exactly does skipping the ok check allow that last unit test to pass? 🤔 |
My reading of the code is that the failure is due to the dynamic cast failing on the C++ side but like you said, this should be failing for more than just these pure virtual instances. I'll see about testing other instances. |
I'm thinking that the issue is that the derived class re-implementation is private meaning that when the binding doesn't expose the derived methods, the failing dynamic cast is exposed. The override can fail silently while the private derived implementation still correctly runs. We have another example: QAbstractItemView::setModel. For QListWidget, QTableWidget, and QTreeWidget, this method is private but the base class implementation is virtual. In the bindings though, each inherits from QListView, QTableView, and QTreeView respectively which each has a public override. In C++, calling For our case, I think the inheritance structure is what breaks the virtual dispatch here. I can't find other examples for other types of classes. I'm also not sure how to best design this. Should the failure be swallowed or surfaced? Arguably, the current panic for |
cc @arnetheduck