[PATCH] KAction (Was: [Bug 50342] konsole crash when quitting)
Waldo Bastian
bastian at kde.org
Thu Nov 28 16:33:03 GMT 2002
On Wednesday 27 November 2002 18:59, Waldo Bastian wrote:
> The following patch fixes the problem for me. It is not really clear to me
> why the sequence of events in the bugreport trigger this bug, Maybe there
> is something else wrong as well?
>
> Short description:
> m_parentCollection is a normal pointer to a KActionCollection and does not
> become null when the KActionCollect gets deleted. However, the QObject
> destructor, called as part of the KActionCollection destructor, deletes
> all child objects (among them KAction objects) and resets parent() before
> deleting them. So if parent() is null, the KAction object is being deleted
> as part of the m_parentCollection destructor and m_parentCollection
> shouldn't be any longer used.
>
> Hmm.. what do we have here.... I guess this means there is something else
> wrong as well, because there is code in ~KActionCollection that resets
> pAction->m_parentCollection and that fails to work for some reason.
OK, what's wrong is that there can be multiple "unnamed" KAction's and that
KActionCollection::_take() uses the name to index the dict. With multiple
KAction's with the same name it can happen that it takes out the wrong one.
See e.g. this backtrace:
#2 0x40455e2a in KActionCollection::_take(KAction*) (this=0x8057448,
action=0x80f1938) at kaction.cpp:3329
#3 0x40455f40 in KActionCollection::take(KAction*) (this=0x8057448,
action=0x80f1938) at kaction.cpp:3351
#4 0x40442727 in ~KAction (this=0x80f1938) at kaction.cpp:285
#5 0x4028281f in QPtrList<KAction>::deleteItem(void*) (this=0xfffffffc,
d=0x4120ff70)
at /home/bastian/cvs/qt-copy/include/qptrlist.h:119
#6 0x40d0d31f in QGList::clear() (this=0x80bfe14) at tools/qglist.cpp:705
#7 0x4008226c in KonsoleBookmarkMenu::refill() (this=0x80bfdb8) at
/home/bastian/cvs/qt-copy/include/qptrlist.h:78
Revised patch attached.
Cheers,
Waldo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kaction1.diff
Type: text/x-diff
Size: 1246 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20021128/71ee9f08/attachment.diff>
More information about the kde-core-devel
mailing list