Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


InDesign UI close

Community Beginner ,
Sep 06, 2021 Sep 06, 2021

Copy link to clipboard

Copied

Hi,

 

I have some UI related memory leaks in our C++ plugin.

I would like to free the allocated memory under application close.

In the StartupShutdown  -> Shutdown function UI elements are down so I cannot reach them.

Could you give me some advice me how can I catch the best moment to free these UI allocated memory.

 

Thx

Karoly

 

 

TOPICS
How to, SDK

Views

86

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Sep 10, 2021 Sep 10, 2021
Hi Karoly, Ah, I see, your plugin does not close InDesign, the user does. Our plugin does not respod to user actions, as it takes control and runs in batch mode. If you know where the leaks occur, can you not  refactor the code so that the new() and delete() are in the same scope ? What kind of leaks are there ? Very best regards, Olivier

Likes

Translate

Translate
Participant ,
Sep 07, 2021 Sep 07, 2021

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 07, 2021 Sep 07, 2021

Copy link to clipboard

Copied

Hi Oliver,

 

Thank you for your answer. 

I have already mapped out the memory leaks.

I use pmruntime.dll from MemoryTracker folder.

 

I would like to free the allocated memory under application closing process.

I don't know how can I get the UI closing function (like StartupShutdown -> ShutDown()) to free these UI allocated memory.

 

Best Regards

Karoly

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 07, 2021 Sep 07, 2021

Copy link to clipboard

Copied

Hi Karoly,

Sorry I misread your post.

I put all my clean-up code just before (or inside) my function that shutsdown InDesign.

void IppIDUtilities::IppQuitIndesign()
{
	// Create a QuitCmd:
	InterfacePtr<ICommand> quitCmd(CmdUtils::CreateCommand(kQuitCmdBoss));
	// Schedule the QuitCmd (Note: ProcessCommand not used with QuitCmd):
	CmdUtils::ScheduleCommand(quitCmd);
}

Very best regards,

Olivier

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 08, 2021 Sep 08, 2021

Copy link to clipboard

Copied

Hi Oliver,

 

Could you explain in more deatil?

- Where should I add my cleaning code?

- Need I call direct the IppIDUtilities::IppQuitInDesign()  and create the scheduled quitCmd command under Startup?

 

Thx
Karoly

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 08, 2021 Sep 08, 2021

Copy link to clipboard

Copied

Hi Karoly,

 

I am assuming that your PLN:

 

  1. gets loaded with InDesign
  2. does something
  3. closes InDesign

 

Is that not the case ?

Very best regards,

 

Olivier

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 08, 2021 Sep 08, 2021

Copy link to clipboard

Copied

Hi Oliver,

 

Yes,

1. Our plugin loading when InDesign start. StartupShutdown -> Starup()

2. We does something (generate documents with data from an app server)

3. Close InDesign

 

Best Regards
Karoly

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

Hi Olivier,

 

I ask the question differently:

How can I catch File -> Exit event?

 

Best Regards
Karoly

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 10, 2021 Sep 10, 2021

Copy link to clipboard

Copied

Hi Karoly,

 

Ah, I see, your plugin does not close InDesign, the user does. Our plugin does not respod to user actions, as it takes control and runs in batch mode.

 

If you know where the leaks occur, can you not  refactor the code so that the new() and delete() are in the same scope ? What kind of leaks are there ?

 

Very best regards,

 

Olivier

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 10, 2021 Sep 10, 2021

Copy link to clipboard

Copied

LATEST

Hi Olivier,

 

Maybe refactoring the solution. 
That's what I was thinking.
We have 2-3 UI related classes with container that contains vectors with dinamically allocated elements.

I can move these containers to en other class if we don't have a better idea 🙂

 

Thak you for your time and patience.

 

Best Regards
Karoly

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines