[Kst] KstTopLevelViewPtr

Andrew Walker arwalker at sumusltd.com
Mon Jun 7 19:00:28 CEST 2004


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 call KstViewWindow::view() it (currently) returns a KstTopLevelViewPtr, which does an implicit reference count (now 1). When the KstTopLevelViewPtr goes out of scope an implicit release occurs (the reference count is now 0) and the KstTopLevelView object is deleted prematurely.

The way around is to either explicitly reference count the KstTopLevelView object when it is first created or never use the KstTopLevelViewPtr. A 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.

Andrew


________________________________________________________________
$0 Bannerless Web Hosting, 10 POP and Web Email Accounts, & more
Get It Now At www.doteasy.com






More information about the Kst mailing list