ID:50226
 
How does it manage to call the wrong function? I don't even mean like some crazy define or something, I literally mean I can step through, watch it call a Register() function, and instead of jumping to the start of the Register() function, jump to the start of the Deregister() function. Also in the wrong class, but seeing as I'm using templates and some crazy type info stuff that's more understandable.
But the wrong function?
How. Does. That. Even. Happen.
Blaming microsoft is usually what people do in this situation.
One thing that's not always obvious with C++ is that various constructors, copy constructors and destructors (and sometimes their supertype versions) can be called automatically when you make a function call. You may be seeing something like this. This is where debugging output to console at the beginning of each function can help.
Try a clean-compile. I've had issues with a variable 'jumping out of scope' for a few lines in a function (obviously, this fucked stuff up), and a clean-compile fixed the issue.
I think I'll just have to find a different way of doing it. I think the problem is that I'm using a specific template which seems to be overriding the default template in some cases but not in others.
I think the fact that it ends up calling Deregister is pure chance, since directly calling Deregister results in an access violation. Presumably the virtual method tables are out of whack with the rest of the class.
Anyway, I'll just have to find another solution to my problem.