[PATCH] RunnerManager

Aaron J. Seigo aseigo at kde.org
Thu Apr 24 16:01:42 CEST 2008


On Thursday 24 April 2008, Jordi Polo wrote:
> There must be some usage of that constructor I am not taking into account
> because as I see it is only used to create localcontext, and work with
> them.

it probably is only used currently to create local contexts, but the 
implementation should not work under that assumption since the behaviour is 
not limited to it.

> But the global context that is the one used by interface also, never 
> gets destroyed.

it's not the global context that matters. when the local context goes out of 
scope, the d ptr is delete and then we have this:

        ~Private()
        {
            qDeleteAll(matches);
            matches.clear();
            delete completer;
        }

so the completer, which is still referenced by other local contexts and the 
global one, gets deleted leaving dangling pointers. the next local context 
that gets destroyed will end up doubly deleting completer. *boom*

> In fact, if d is going to be QExplicitlySharedDataPointer'd is not the same
> that just let everyone use the same globalContext and kill the localContext
> idea ?

the global context may be changing in the main UI. by having a local context 
we avoid race conditions where matches get registered that no longer actually 
match the query being added as if they did.

(and looking further, we may do just fine with QSharedDataPointer, even)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080424/51798ed3/attachment.pgp 


More information about the Panel-devel mailing list