[KParts] patch: don't emit urlChanged, when url is the same

Michal Humpula michal.humpula at seznam.cz
Tue Dec 24 12:50:29 UTC 2013


On Tuesday 24 of December 2013 13:22:05 David Faure wrote:
> On Tuesday 24 December 2013 12:30:56 Michal Humpula wrote:
> > Hi there,
> > 
> > as suggested without fully functional reviewboard, here is the little
> > patch
> > for discussion.
> > 
> > Emit urlChanged only when actually changing url trough setUrl. The
> > drawback
> > of this is that now the fast assignment is replaced by possibly expensive
> > string comparison.
> 
> That's ok, this method is typically not called 10000 times per second.
> 
> > On the other hand, when the urls are the same, the emit
> > wont fire and whole bunch of potentially expensive operations connected to
> > that signal will not happen.
> 
> Yep. The patch makes a lot of sense, please commit it - at least to
> frameworks. Do you also need it in kdelibs master?

Nope, no need. Just to be sure, pushing to master branch of 

git at git.kde.org:kparts

right?

> > IMHO the same could/should be done for others setters.
> 
> Which are they?

Ups, the rest of the setters don't emit any signals, so that's none.

But, if I have a green light, then I would like to change the second callsite 
of urlChanged() as well. Please, see attached patch. The reasoning is the same 
as with setUrl.

Cheers
Michal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: emit.patch
Type: text/x-patch
Size: 799 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20131224/d6c9fef3/attachment.patch>


More information about the Kde-frameworks-devel mailing list