THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/08/2003 at 18:25, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.100
Platform: Mac OSX ;
Language(s) : C++ ;
---------
I'm writing a file-animation plugin (ie one which loads a different file per frame), and everything works fine until I try to free the document I've loaded.
I've tried using BaseDocument::Free() and also ::KillDocument(), but both crash C4D.
Here's the relevant bit of code:
class FileAnim : public ObjectData
{
// ...
BaseDocument* _anidoc; // initted to 0 in FileAnim()
};
BaseObject*
FileAnim::GetVirtualObjects(PluginObject* op, HierarchyHelp* hh)
{
Filename filenm;
// ...
// cache not valid: must load new file
if (_anidoc)
{
// HELP! both of these will crash us!
::KillDocument(_anidoc);
BaseDocument::Free(_anidoc);
}
_anidoc = ::LoadDocument(filenm, true /*showerrors*/);
return _anidoc->GetFirstObject();
}
How should I be freeing the loaded document?
Thanks.
.angus.