[kdelibs/frameworks-kcore] tier1/libkcoreaddons/src/io: KLockFile: Remove dependency on KSharedPtr. KShared has been replaced by QSharedData and KSharedPtr by QExplicitlySharedDataPointer. Also use KCOREADDONS_EXPORT.

David Faure faure at kde.org
Sun Oct 23 11:18:25 UTC 2011


On Saturday 22 October 2011 19:08:03 Romain Perier wrote:
> Git commit 4de6ba9166a317fa772b2f20f22fc5c73dee7109 by Romain Perier.
> Committed on 22/10/2011 at 12:47.
> Pushed by perier into branch 'frameworks-kcore'.
> 
> KLockFile: Remove dependency on KSharedPtr. KShared has been replaced by
> QSharedData and KSharedPtr by QExplicitlySharedDataPointer. Also use
> KCOREADDONS_EXPORT.
> -class KDECORE_EXPORT KLockFile : public KShared
> +class KCOREADDONS_EXPORT KLockFile : public QSharedData
>  {
>  public:
> -   typedef KSharedPtr<KLockFile> Ptr;
> +   typedef QExplicitlySharedDataPointer<KLockFile> Ptr;

That's double refcounting, one in QSharedData and one in 
QExplicitelySharedDataPointer.

But anyway, I wonder why we need sharing on that object at all. AFAICS it can 
just be created on the stack where needed, or as a member var.

(e.g. 
http://lxr.kde.org/source/extragear/kdevelop/kdevplatform/shell/sessioncontroller.cpp#821
could just be on stack and 
http://lxr.kde.org/source/kde/kdelibs/kdecore/config/kconfigini_p.h#35 should 
just be a KLockFile member variable, same in kautosavefile)

=> Remove the Ptr typedef altogether, and the QSharedData inheritance.

(this doesn't block merging into frameworks though, we can do it afterwards, 
let's just not forget ;)

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).



More information about the Kde-frameworks-devel mailing list