Summary: | KWidgetItemDelegate crashes when applied to QListView without model | ||
---|---|---|---|
Product: | [Unmaintained] kdelibs | Reporter: | Thomas Fischer <fischer> |
Component: | kdeui | Assignee: | kdelibs bugs <kdelibs-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | cfeck |
Priority: | NOR | ||
Version: | 4.6 | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 4.7.2 | |
Sentry Crash Report: | |||
Attachments: | Example code to reproduce crash |
Description
Thomas Fischer
2011-09-28 07:23:30 UTC
Created attachment 64028 [details]
Example code to reproduce crash
Hm, the test code does not set a model on the view. While this test case triggers a crash, I would like to know if there is a real situation where you get it. I mean, without a model, the view is useless. (In reply to comment #2) > Hm, the test code does not set a model on the view. While this test case > triggers a crash, I would like to know if there is a real situation where you > get it. I mean, without a model, the view is useless. I came up with this problem when programming the delegate before the model and testing if the program would compile and run. Even if it makes no sense to call setItemDelegate on a view that has no model yet, crashing is not the right answer, especially as QAbstractItemDelegate doesn't it either. I would recommend to insert a Q_ASSERT_X macro or checking for model==NULL and return silently or with some kWarning message. Git commit d1570cc40cdefd5623dba1324b05494c812132b7 by Christoph Feck. Committed on 28/09/2011 at 13:06. Pushed by cfeck into branch 'KDE/4.7'. Fix crash when no model has been set (yet) In the case a view is shown before its model has been set, QAbstractItemView internally uses an "empty" model. Instead of connecting to the empty model, we check for the null pointer. BUG: 282952 FIXED-IN: 4.7.2 M +3 -0 kdeui/itemviews/kwidgetitemdelegate.cpp http://commits.kde.org/kdelibs/d1570cc40cdefd5623dba1324b05494c812132b7 |