Plugin Exit procedure


#1

Hi Jules,
I see that sometime my plugins crash on exit.
Analysing the Ableton Live Log I found that they always crash in the ProcessBlock method.

Is there any way to delay the exit procedure until the processBlock method is over?
I tryed to manage a boolean like :
ProcessBlock(…)
{
m_bIsProcessing = true;
… processing algorithm …
m_bIsProcessing = false;
}

and insert this in the destructor :
while (m_bIsProcessing==true) {}

but instead of crash, it remains in the loop until I shut down Ableton.

What can I do?
Thanks in advance
Andrea


#2

I find it very hard to believe that any host would call the plugin’s process callback while it’s in the middle of deleting it! That’d be a guaranteed way to crash any plugin. Are you perhaps misinterpreting what’s happening, or doing something in your process method that interacts with the UI thread?


#3

Hi Jules,

my suspect (but it’s olny a suspect) is that it crashes because I’m deleting it when it is in the middle of the process method.
A proof of this is that it doesn’t crash but it goes into infinity loop if I use the m_bIsProcessing bolean as I write in the last message.

I’ll make other tests in order to understand better what is happening in case of crash.
But there isn’t any way to delay the destruction of the filter until the process method is not complete?
Or there is any way to intercept the exit command, avoid it, wait for process to end and then close the plugin?

Thanks,
Andrea


#4

You’re not seriously trying to figure this out without using a debugger, are you?