Search code examples
c++crashmaya-api

Maya C++ API : Function causes undefined crash without entering the function


I'm currently working on a plugin to stream data from Maya to a custom 3D engine. When I'm fetching existing data:

Point Light Function

Including the commented function above causes the Maya to crash after the plugin is succesfully initialized:

Crash Position

But the "pSendPointLightData()" function or the switch case hasn't even been called or triggered (It's not included in the MFnPlugin class or the constructor). It just crashes before reaching the next console output "checking connection".
No other console outputs before or inside the function are being triggered. It crashes directly after the else brackets triggering no other error messages. When the function is commented out of the code, the application runs fine and is reaching the "pAllocNode()" function in the switch case.

Does anyone have any ideas why including the function magically crashes the application without being called or reached?
Is there a way to debug this since I've tried using breakpoints, console outputs, and try-catch exceptions which do not catch anything?
It seems to me that it's an undefined behavior.


Solution

  • The call stack didn't tell me much other than that the initializePlugin() function had been called. pSendPointLightData() was empty and only accepted a pointer reference to a MObject. The plugin was dynamically linked as a .mll file.

    However, updating visual studio seems to have solved the issue.