View Single Post
Old 08-12-2015, 07:00 PM   #26
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by mviljamaa View Post
Okay so got the .h/.cpp splitting done. And I did the forward declaration and included the header as was suggested above.

I'm now seeing the plug-in crash at startup when I've added a call to the IPlugMyPlug::AddProcessor() function from the IPlugMyPlugControls.cpp (that is, it's called when the user has requested a processor to be created using the GUI). It's not the call to the function itself that causes a crash, but when in the call body I do

processors.push_back(new MyPlugProcessor());

Where processors is a std::vector<MyPlugProcessor*> and a private member in the IPlugMyPlug.h file.
It's possible the memory allocation of "new" fails (fairly unlikely) or the constructor of MyPlugProcessor does something nasty.

Additionally it's possible your processor vector is accessed simultaneously from another thread, so you shouldn't do the push_back without synchronization (basically mutex locking in IPlug context) of the threads.

You moving the code to the .cpp file likely has nothing to do with this directly, some problem just started manifesting itself at the same time.

Your project now seems complicated enough that it is very hard to anymore understand what you are doing and help you effectively. Have you considered posting the source code online, so it could be more quickly reviewed when you need some help with it?
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote