Bug 159369 - KCategorizedView segfaults without a proxy model or category drawer
Summary: KCategorizedView segfaults without a proxy model or category drawer
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdeui (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Rafael Fernández López
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-15 19:34 UTC by David Benjamin
Modified: 2008-06-10 13:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
fix crashes when m_proxyModel is NULL (1.15 KB, patch)
2008-03-15 19:35 UTC, David Benjamin
Details
Test case for proxy model (657 bytes, text/x-c++src)
2008-03-15 19:37 UTC, David Benjamin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Benjamin 2008-03-15 19:34:24 UTC
Version:            (using Devel)
Installed from:    Compiled sources
OS:                Linux

I was playing with KCategorizedView and noticed that it crashes with a segfault when the supplied model is not a KCategorizedSortFilterProxyModel (and thus m_proxyModel is NULL). The crashes occur when one single-clicks an entry, or double-clicks to rename it.

(There are parts of the code that check of m_proxyModel is NULL, so I assume this usage of the class is meant to be valid.)

Patch attached below.

The same also occurs when no KCategoryDrawer is supplied, but I'm not sure how to fix that.
Comment 1 David Benjamin 2008-03-15 19:35:01 UTC
Created attachment 23910 [details]
fix crashes when m_proxyModel is NULL
Comment 2 David Benjamin 2008-03-15 19:37:05 UTC
Created attachment 23911 [details]
Test case for proxy model

Remove the drawer bit to fire off the other crash.

Steps to reproduce:
1. Click an entry

For the drawer (after the patch is applied, otherwise it crashes before you
finish this):
1. Double-click an entry
2. Type a new name
3. Press enter
Comment 3 Rafael Fernández López 2008-03-21 20:30:38 UTC
Thanks for notifying. I can't check the patches nor the problems at the moment, but I can tell some info:

- KCategorizedView is not meant to be used with a model different from a KCategorizedSortFilterProxyModel. On the other hand, it shouldn't force it to crash.

About the crashes, I am aware of some "random" crashes, that happens if you don't call, for instance: listView->setSpacing(10);

If calling to that method makes the view not to crash anymore, please close this bug. If it is still crashing, please confirm so, and I will take a look next week.

Thank you.
Comment 4 David Benjamin 2008-03-23 01:04:57 UTC
The crashes still occur for me when adding the call.
Comment 5 Rafael Fernández López 2008-06-10 13:37:27 UTC
Thanks for your observations. KCategorizedView shouldn't crash now.