Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Re: Deleting a palette form a Session Targetengine

$
0
0

Hi Trevor,

 

The question is why and/or when the palette should be destroyed, depending on how your app interacts with it. Maybe I missed something, but I was assuming that the palette provides a persistent UI. Its state then basically depends on what the user does (including the event that he closes the window). Using a persistent container, $.UserInterface, offers you in addition the option to safely and programatically close the window when some condition is reached.

 

Anyway I still don't see why you would need to have an onClose handler in that case. If your purpose is only to free up memory in your engine when the user closes the palette, this is not that critical. As long as your code handles at most a single instance of the object and does not introduce memory leaks—as guaranteed by $.UserInterface—there is not serious risk in this matter.

 

Note that my sample code does not use closures, that is, ExtendScript workspaces, so there is no residual reference to the palette once we have successively done:

 

F.W.close();

F.W = null;

delete F.W;

 

From that point the automatic garbage collection should work the regular way—and $.summary() should never report more than one Window reference. Am I wrong?

 

@+

Marc


Viewing all articles
Browse latest Browse all 37788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>