[Kst] Re: KstTopLevelViewPtr

George Staikos staikos at kde.org
Mon Jun 7 19:25:33 CEST 2004


On Monday 07 June 2004 13:00, Andrew Walker wrote:
> Hi George,
>
> Here's why I don't think you should be using KstTopLevelViewPtr, or should
> be explicitly reference counting KstTopLevelView when it is created:
>
> When a KstTopLevelView object is created from KstViewWindow it is
> (currently) not reference counted. Thus, its reference count is 0. When you

   Yes it is.  That's what my patch changed.  It was being stored as a 
KstTopLevelView* member before, which is wrong.  KstShared should never be 
refered to by *, only by KstSharedPtr.  That's what breaks the reference 
counting.

> The way around is to either explicitly reference count the KstTopLevelView
> object when it is first created or never use the KstTopLevelViewPtr. A

   Explicit reference counting with KstSharedPtr is broken by design.  It's 
never supposed to happen.

> third option would be to add the KstTopLevelView object to a list which
> contains KstTopLevelViewPtr, but as the windows are handled by KMdi I don't
> think this is desirable.

  As long as someone holds a KstSharedPtr to a KstShared object, it's 
impossible for the reference count to go to 0.

-- 
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/



More information about the Kst mailing list