LinkBox links and BaseDocuments
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/11/2006 at 10:45, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.2-10.0
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;---------
I need information on how to handle a possible situation. My plugin dialog has a copy-paste operation. The operation has a LinkBox for a source object (copy). You then select other objects in the Object Manager and paste attributes from the source to the destination objects.That's easy enough. But it seems that this should also be able to handle copying from one document to another without much ado (source in one document, destinations in another). The problem is how to guarantee that the source hasn't become invalid - say by closing the source document (!). Since the only way to get a link is LinkBoxGui::GetLink(BaseDocument* doc), even to check if the source object is still valid, I must store the source document in a pointer. If the document is closed, there is no way for me to verify that the pointer is valid. This spells 'instant crash'.
Any ideas on how to avoid that potential disaster?
Thank you very much,
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/11/2006 at 10:51, xxxxxxxx wrote:
How about this?
BaseDocument* doc = GetFirstDocument(); for (doc = GetFirstDocument(); doc; doc = doc->GetNext()) { if (doc == copyDoc) break; } if (!doc) // Oops! :)