[PATCH] Don't loose shortcuts when closing global shortcut kcm
l.lunak at suse.cz
Sun Jan 20 02:20:08 GMT 2008
On ne 20. ledna 2008, Aurélien Gâteau wrote:
> Kevin Ottens wrote:
> > Le samedi 19 janvier 2008, Aurélien Gâteau a écrit :
> >> When one close the "global shortcut" kcm (kcmshell4 keys), all global
> >> shortcuts are gone. Include kwin shortcuts, so there is no more alt+tab
> >> or alt+f4. Attached patch fix this. Ok to commit and backport?
> > Hm, from your patch, doesn't it mean we'll leak memory instead?
> Hm, yes. It's the first time I introduce a leak on purpose :/. The goal is
> to avoid having the KAction destructor called, as it would remove the
> global shortcut.
> It's not a serious leak: the allocated memory used to be freed when the kcm
> was destroyed, which happened when you quit the kcm host process. It's
> still freed at this time now.
> The problem comes from the fact that we need to create KAction instances
> for the shortcuts so that we can use KShortcutsEditor, but those KAction
> are not the real ones, we just fake them.
> An alternative solution could be adding a flag to KAction to instruct it not
> to remove the global shortcut, but it would clutter the API for a very
> marginal use IMHO.
> Then in the KCM we would create a FakeAction class, inheriting from KAction
> and reimplementing removeShortcuts() to be an empty method. Don't know
> which one is the best.
Wouldn't work - virtuals don't work as virtuals in ctors/dtors.
On so 19. ledna 2008, Kevin Ottens wrote:
> Le samedi 19 janvier 2008, Aurélien Gâteau a écrit :
> For this part I'm just checking because it looks like it'll clash with a
> fix I'm working on. I'd prefer avoiding stepping on your toes. ;-)
Hmm, you too :) ? I've already sent a mail to Andreas asking for more
documentation on KGlobalAccel - my suspicion in this case is that the
NoAutoloading flag means it's used from the kcm (i.e. the
do-not-remove-shortcut flag), but that's just guessing. But removing the
parent is a kludge.
SUSE LINUX, s.r.o. e-mail: l.lunak at suse.cz , l.lunak at kde.org
Lihovarska 1060/12 tel: +420 284 028 972
190 00 Prague 9 fax: +420 284 028 951
Czech Republic http//www.suse.cz
More information about the kde-core-devel