[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 203114] KSelectAction problems requesting widget when there are
From:       Daniel Calviño Sánchez  <danxuliu () gmail ! com>
Date:       2009-08-08 19:43:40
Message-ID: 20090808194340.153FB14BEA () immanuel ! kde ! org
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=203114





--- Comment #2 from Daniel Calviño Sánchez <danxuliu gmail com>  2009-08-08 21:43:37 ---
Created an attachment (id=35995)
 --> (http://bugs.kde.org/attachment.cgi?id=35995)
Fixes for the two bugs

Now, the fixes for the bugs.

I haven't updated the header in kselectaction.h nor kselectaction.cpp as it
wasn't done in the last commits... but the last copyright stated is from 2007.
I don't know if that has to be updated due to legal issues or something like
that.

The fix for the first bug is just disabling the KComboBox if there are no
actions when it is created.

The fix for the second bug is creating a QToolButton no matter what parent is
given, and if it is a QToolBar, apply some specific methods to it. However, I
have also added a _k_toolButtonDeleted(QObject*) method in KSelectActionPrivate
that behaves like _k_comboBoxDeleted(QObject*): it removes the QToolButton from
the list of buttons used internally by KSelectAction and KSelectActionPrivate.

The reason to add _k_toolButtonDeleted(QObject*) is this: if a QToolButton is
requested but not released, when the parent widget is deleted it destroys the
QToolButton. The application will always crash as the button would be tried to
be used in ~KSelectActionPrivate() to remove an event filter (or it may crash
even before if an action is added or removed from KSelectAction). I suspect
that, when QToolBar is used as parent, no crash happens because it takes care
of calling releaseWidget(QWidget*).

I have added the aforementioned method because there was already one for
KComboBox. If you think that it isn't needed, and that a requested widget
always has to be released, the tests must be changed or they will crash :)

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic