From: Shrikant Sharma (Shrikant.Sharma++at++BuroHappold.com)
Date: 04/29/2004 08:30:53
Hi all
Has anyone used the mouse navigation features like what pfvmNavigator
provides with mfcperformer? I know that pfvmNavigator can be added directly
as a module to a pfvViewer object, but how would one use pfPipeWindow that
mfcperformer uses?
Or, another way, is it possible to use pfvViewer in mfcperformer? Thanks.
Shrikant
-----Original Message-----
From: Juan Manuel Cappi [mailto:jcappi++at++sol.info.unlp.edu.ar]
Sent: 28 April 2004 20:47
To: info-performer++at++sgi.com
Subject: [info-performer] Reference counting question
Hi!
I have some doubts regarding the reference counting mechanism used
in Performer and I'm a bit confused.
I wrote the following code:
pfText *text;
pfString *str;
pfInit();
pfConfig();
str=pfNewString(NULL);
text=pfNewText();
printf("%i\n" , pfGetRef(str)); //0
printf("%i\n" , pfGetRef(text)); //0
pfAddString(text,str);
printf("%i\n" , pfGetRef(str)); //1
printf("%i\n" , pfDelete(text)); //1 - Delete ok
printf("%i\n" , pfGetRef(text)); //0
(1) printf("%i\n" , pfGetRef(str)); //1 ?!
Things went fine until the last line(1). According to the man-pages,
in the pfMemory definition it states: "pfDelete frees the memory
associated with mem if its reference count is <= 0. When an object is
freed, it decrements the reference count of all pfMemories that it
once referenced and will delete any of these pfMemories with reference
counts that are <= 0. Thus, pfDelete will follow all reference chains
until it encounters a pfMemory which it cannot delete.". From this
text I understood that line (1) should be 0, since the text deletion
should have decremented the string's reference count to 0 and then
deleted it. But, due to the behavior shown in the example, I guess
there is something I'm not getting right. I would be very grateful if
someone could help me with this issues:
Is something wrong with the code which is causing this "error"?
If this is the expected behavior; how can I know that "str" is no
longer referenced by a pfText in the case pfRemoveString is not called
before pfDelete?
In which cases the deletion of a pfMemory cause a cascade deletion?
Thanks in advance,
Juan Manuel
-----------------------------------------------------------------------
List Archives, Info, FAQ: http://www.sgi.com/software/performer/
Open Development Project: http://oss.sgi.com/projects/performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
-----------------------------------------------------------------------
This message has been scanned for viruses by MailControl - www.mailcontrol.com
This archive was generated by hypermail 2b29 : Thu Apr 29 2004 - 08:32:36 PDT