Constraints before init fix

Alex Merry kde at randomguy3.me.uk
Mon Aug 11 18:28:38 CEST 2008


We've had several issues with applets having constraintsEvent() called before 
init() has been called at Plasma startup.

As far as I can ascertain, this is because control is being passed to an event 
loop in Corona::LoadLayout between the call to Containment::restore(), which 
creates the applets, and init() being called on the applets.  This causes a 
timeout on a timer attached to Applet that calls flushPendingContraints(), 
which in turn calls constraintsEvent().

There are two solutions I can see to this: either we tell applet developers 
that they can't count on init() being called before constraintsEvent(), or we 
can do something like the attached patch.

This patch doesn't start the timer if one of the constraints is 
Plasma::StartupCompletedConstraint (set by Containment::restore()).  Instead, 
the onus is on the code that calls Containment::addApplet() to also call 
flushingPendingConstraints().

Alex


PS: wondering why an event loop is called?  One reason I've seen in a 
backtrace is that Plasma::Icon::setUrl makes use of KIO::NetAccess methods, 
which create their own event loop.


-- 
Proud KDE hacker: http://www.kde.org
Get KDE 4.1 - out now!
Arch Linux: perfect for geeks like me - http://www.archlinux.org
OpenSUSE: just works - http://www.opensuse.org


-------------- next part --------------
A non-text attachment was scrubbed...
Name: plasma-constraints-before-init.diff
Type: text/x-patch
Size: 1942 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080811/a8178856/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080811/a8178856/attachment.pgp 


More information about the Plasma-devel mailing list