Review Request: Fix on KShortcutEditorDelegate, when opening a new editor, and closing the already opened one. If they are in different "groups" they will crash

Darío Andrés andresbajotierra at gmail.com
Tue May 19 17:27:40 BST 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/717/
-----------------------------------------------------------

Review request for kdelibs.


Summary
-------

When a new shortcut is going to be opened for editing, if there is already an "opened" one, it should be closed.

The following code was used for look for the currently opened shortcut item: 

index.sibling(m_editingIndex.row(), Name);
KShortcutsEditorItem *oldItem = KShortcutsEditorPrivate::itemFromIndex(view, idx);

when "index" is the index of the new shorcut to be opened
and "m_editingIndex" the currently opened index (which should be closed now)

However, in some cases, the new index may be part of a diffent group (in bug 181024 it has the "Kate" group and the "Find in Files" group)
so calling "index.sibling" will return an invalid index, therefore an invalid item will be fetched leading to the crash when trying to collapse that currently opened shortcut editor.
(( It doesn't crash in all the cases. In the Kate report one, you need to first click in the second item of the second group , and then in the Find In Files" item in the "Find in Files" group )) 

My proposal is just using m_editingIndex. (which already contains the current index of the opened item)
I don't know if there is some drawback for not doing it this way.

Regards


This addresses bug 181024.
    https://bugs.kde.org/show_bug.cgi?id=181024


Diffs
-----

  svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs/kdeui/dialogs/kshortcutseditordelegate.cpp 969788 

Diff: http://reviewboard.kde.org/r/717/diff


Testing
-------

I have tested it at it works. I could not find any regression.
Also, this fixes a graphical bug, when opening shortcuts of different groups (one on groupA, one on groupB, one on groupA, and so on), it will leave the action name in bold


Thanks,

Darío





More information about the kde-core-devel mailing list