Kicker child panels' PanelAppletOpMenu

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


This was rejected the first time because of the patch size -- trying again 
with the patch gziped...
===
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.gz
Type: application/x-gzip
Size: 7222 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20021023/cc66a87a/attachment.bin>


More information about the kde-core-devel mailing list