[Kde-pim] D-Pointer problem
Tom Albers
tomalbers at kde.nl
Wed Jun 11 19:57:10 BST 2008
Hi,
Executive summary:
New working patch attached. Can I commit it now or on monday or when? afaik this bic...
Op zaterdag 31 mei 2008 23:44 schreef u:
> One thing I noticed is that you have (accidentally) moved the
> initialization of mReadOnly after readConfig().
Nice catch. Fixed.
> I suggest to move mIdentities and mShadowIdentities also to
> IdentityManager::Private.
Done.
> And why is mConfig not in Private? If you
> want to use pimpl then please don't do it half-heartedly.
That variable was used on the lines of the crash, so I tried to kept it out as an experiment to see if it was still crashing. it was. It was not meant to be that way in the patch I sent to this list.
> The following code snippet is really ugly (which isn't your fault):
> q->mIdentities << Identity();
> q->mIdentities.last().readConfig( configGroup );
> if ( !haveDefault && q->mIdentities.last().uoid() == defaultIdentity ) {
> haveDefault = true;
> q->mIdentities.last().setIsDefault( true );
> }
>
> Instead of using QList::last() all the time I'd use a temporary
> variable:
> Identity identity;
> identity.readConfig( configGroup );
> if ( !haveDefault && identity.uoid() == defaultIdentity ) {
> haveDefault = true;
> identity.setIsDefault( true );
> }
> q->mIdentities << identity;
This change actually fixed the initial crash which made me post here! Your code is a simple change, though makes it much more readable and fixes the crash.
After that the code was crashing due to the missing copy ctor and operator=, after implementing that, it is now working.
Thanks for the help Ingo and Frank!
Toma
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dpointer.diff
Type: text/x-diff
Size: 28121 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20080611/0e247a74/attachment.diff>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list