General XMetaL Discussion

  • Polly Poon

    ChooseTemplate issue

    Participants 0
    Replies 1
    Last Activity 12 years, 11 months ago


    I am using XMetaL 5.5 .

    I have created a function to override the File > New operation with the following:

    string newFilePath = null;
    newFilePath = this.xMetalHelper.getApplication().Documents.ChooseTemplate();

    where this.xMetalHelper.getApplication() would return an existing instance of XMetaL.Application.

    I found that during runtime, if i click on the Cancel button on the ChooseTemplate dialog, XMetaL cannot be shut down properly, a remant instance would be left and I have to go to Task Manager to clear the process.

    Is there a way to properly handle the ChooseTemplate process? How to exit gracefully if a user click the Cancel button on the ChooseTemplate dialog so there won't be memory leak?



    Derek Read

    Reply to: ChooseTemplate issue

    I'm not sure I understand the need to instantiate XMetaL Author as a COM object here (unless this script is not living inside an MCR file, which seems likely as this code looks like C# or something).

    I don't think this has anything to do with a particular API in the product. One reason it might not shut down properly is because there is an open reference to it somewhere.

    Try to find an appropriate place to explicitly (on purpose) destroy the reference as soon as possible after you no longer need it and you should be OK.

    If you think this is a bug in the product please submit a case to XMetaL Support including complete sample code to reproduce it. If possible, simplify the project to the point where it only contains just enough code to reproduce the issue as code that does something not directly related to the issue will confuse things.


  • You must be logged in to reply to this topic.

Lost Your Password?