Which automation objects are to be released to quit MindManager application?

  • 1
  • Question
  • Updated 8 years ago
  • Answered

the API says, "If you have not made the application visible, then MindManager will close once all references to the automation objects are relased and all documents are closed."

As I write a macro, where the application is not visible, I'm struggling with what automation objects are to be released.

In a minimal version of my macro, I only add one document to the documents collection. I don't add any subtopics or whatsoever. Then I save this document (SaveAs). In this case, the MindManager application does not quit, although after I save the document, I also close it.

In the case, I don't add a document to the documents collection (just call "AllDocuments") and then leave the macro, the MindManager application quits.

It would be nice to know which automation objects are to be released.

Thank you for your help.

Photo of centershock


  • 3 Posts
  • 0 Reply Likes

Posted 9 years ago

  • 1
Photo of Andrew Wilcox

Andrew Wilcox, Champion

  • 1041 Posts
  • 181 Reply Likes
You may get an answer by searching or posting in this group
Photo of Nick Duffill

Nick Duffill, Champion

  • 601 Posts
  • 245 Reply Likes
Are you using MindManager's built-in macro language, or a macro language from another application?

MindManager's macro language (MMScript) automatically releases all MindManager objects, so there is no need to release any of them to allow MindManager to close successfully. However, MMScript always uses MindManager as a visible application.

All other types of automation (external compiled applications, external macros, or MindManager Add-ins) require all pointers to objects owned by or created by the MindManager application object to be released on exit, otherwise the MindManager process will not close. For example, if you create a document and save the returned document pointer, you must release this pointer later to allow MindManager to close. This also applies to the MindManager Application object itself.

It can be hard to identify unreleased pointers in code, so the best thing to do is to always release local pointers in every routine that uses them, and have a single routine that does a clean up of global pointers on exit.

This conversation is no longer open for comments or replies.