MFC 错误仅在发布模式下"Failed to create an empty document"
MFC error "Failed to create an empty document" in Release mode only
我在MFC/SDI和Visual Studio 2008下运行一个应用程序。
我仅在发布模式下收到错误"无法创建空文档"。我发现有问题的代码是我在下面向您展示的。仅当输入参数是电子邮件字符串即 xyz@yahoo.com 时,才会触发该错误。同样在调试模式下,它工作得很好。
有人可以给我解释为什么会发生这种情况吗?
void CUtils::RemoveEndingSlash(CString *str) {
if (str->GetAt(str->GetLength()-1) == '/') {
*str = str->Left(str->GetLength() - 1);
}
}
确切的违规代码是
str->GetAt(x).
我解决了使用输入参数按值而不是按引用更改上述代码的问题。
问候
好的解决了
。
缓冲区溢出,因为某些调用方在传递空字符串之前。
我没有检查空字符串,因此我得到了缓冲区溢出。
相关文章:
- "error: no matching function for call to"构造函数错误
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 调用专用模板时出错"no matching function for call to [...]"
- C++ Singleton - Prevent ::instance() to variable
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- dopen():不以 root 身份运行时"failed to map segment from shared object"
- 使用外部依赖项运行 VC++ 单元测试时"Failed to set up execution context"
- SDL_Init失败并显示'SDL_Error: Failed to connect to the Mir Server'
- libgit2:git_clone() 失败并出现"failed to create ssl object"错误
- 尝试在 Kdevelop中调试时如何修复"WebConnect: Starting server failed. Try to remove stale socket."?
- QCamera::start给出神秘的"failed to start"日志消息
- openCL 和"Failed to set kernel argument"失败在哪里出错?
- Eclipse debug: "Error in final sequence - Failed to execute MI command"
- "QFileSystemWatcher: failed to add paths"但仍然有效
- 错误:'Failed to specialize function template' C2893 'std::invoke'
- C# DLL 导入失败:"The application has failed to start because its side-by-side configuration is incorrect
- MFC 错误仅在发布模式下"Failed to create an empty document"
- GLFW "WGL: Failed to find a suitable pixel format"
- Visual Studio 2015 Update 1 C++ "The breakpoint failed to bind"
- GLFW 无法创建窗口:"GLX: Failed to create context: GLXBadFBConfig"