Program behave abnormally when deployed

Solution 1:

If it happens outside the debugger, but not inside the debugger, you may be able to reproduce it using the _NO_DEBUG_HEAP environment variable, as described here (amongst other places): Link

Setting this variable should make the program running under the debugger behave more like the program running outside the debugger.

You can set environment variables in Visual Studio, so they affect only the debugged process: How do I set specific environment variables when debugging in Visual Studio?

Solution 2:

Changing the visibility of member variables can potentially change the layout of the class, since C++ only defines an ordering within visibility sections, not between them. Perhaps your change is breaking some code that isn't recompiled by your project.