Kicker child panels' PanelAppletOpMenu

Scott Wheeler wheeler at kde.org
Wed Oct 23 01:26:41 BST 2002


On Friday 18 October 2002 0:04, Scott Wheeler wrote:
> Rather than keeping track of such a base class, instead pass a pointer to 
the 
> PanelOpMenu through the parenthood latice.  This would work, but is lacking 
> in elegance, but would require a less fundamental change to the way things 
> are currently done.

Ok, after several talks to Aaron on IRC, this method was decided to be best 
for the moment.  It was a little tedious to implement, but doesn't 
fundamentally change much -- just adds an opMenu pointer to a lot of 
constructors and such to pass the opMenu through what I referred to as the 
"parenthood latice".

The only other significant thing that happens is that I had to move the code 
to add items to the popup menus to a new method that is called when the 
QPopupMenu::aboutToShow() signal is emitted.  This was necessary because 
otherwise there is a loop in the the constructors:

from Panel::Panel():

_containerArea = new ContainerArea( KGlobal::config(), _frame, opMenu() );

Where opMenu() creates a new object if it doesn't currently exist.  However 
the constructor for the opMenu calls Panel::containerArea() which returns 
_containerArea, which isn't done being constructed.  So, segfaults happen...

To clean this up the constructor for the opMenu just create an empty 
QPopupMenu and the code to populate it is deferred until the above signal is 
emitted.  At that time calling Panel::containerArea() is safe again.

Ok, to commit?

-Scott

-- 
Many people would sooner die than think; in fact, they do so. 
--Bertrand Russell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kicker.patch
Type: text/x-diff
Size: 43014 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20021023/f43dbd6b/attachment.patch>


More information about the kde-core-devel mailing list