Most likely the crash is in a deeper function. The debugger show it in your
function, because it is the nearest one with source code available.
Is the C++ debugger capable of showing all stack trace entries, not just the ones that you have source code for?
This could help in detecting the real issue.