On 9/4/20 12:06 PM, Kyle Edwards wrote:
Interestingly, the stack trace shows that the widget's destructor is being called within one of its own methods. Whether it's the same widget or just the same class but a different instance, I'm not sure (ASAN's stack trace doesn't print this information.)

After some more investigation, I've learned more about the nature of the problem.

The createEditor() override returns a button which, when clicked, opens a file dialog (through QFileDialog::getOpenFileName() - this will be important in a bit). The opening of this dialog causes the editor to lose focus, which result in QAbstractItemDelegate emitting its closeEditor() signal, which in turn destroys the editor. The destroying of the editor also attempts to delete the file dialog, since it's a child of the editor. However, the file dialog was allocated on the stack by QFileDialog::getOpenFileName(). So, attempting to delete the stack-allocated dialog results in a crash.

So I guess the question is, how do I prevent QAbstractItemDelegate from emitting closeEditor() when the file dialog opens? Either that or prevent closeEditor() from actually closing the editor... I see something in QAbstractItemView::closeEditor() about an editor being "persistent", does that have anything to do with this?

Kyle

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to