发行版本出现意外行为 [英] Unexpected behave on Release version

查看:67
本文介绍了发行版本出现意外行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我遇到问题的功能



This is the function i am having problem

void CDesktopApp::OnSillyPaste()
{
	
	CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
	// create a new MDI child window
	pFrame->CreateNewChild(
		RUNTIME_CLASS(CPrintingFrame), IDR_DesktopTYPE, m_hMDIMenu, m_hMDIAccel); // application fail around this line during runtime of release version. but debug version perform normal. 
//definition of CPrintingFrame 
/*
class CPrintingFrame: public CMDIChildWndEx
{};
*/

//IDR_DesktopTYPE is a macro with value 130
//hMDIMenu is HMENU type;
//m_hMDIAccel is HACCEL type;
}

//another function that behave well

void CDesktopApp::OnCustomerFileRequest()
{
	CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
	// create a new MDI child window
	pFrame->CreateNewChild(
		RUNTIME_CLASS(CCustomerReportFrm), IDR_DesktopTYPE, m_hMDIMenu, m_hMDIAccel);
}





我在代码中说它在那里失败了(我测试过)。该错误与堆损坏有关。什么可能出错?



如果要求更多的代码,我很难判断还有什么要放......



as I stated in the code that it fails there (I tested). The error is related with heap corruption. What can go wrong?

If ask for more code it would be hard for me to judge about what else to put..

推荐答案

这是一篇关于调试与发布的深入文章 - 生存版本 [ ^ ]
Here is an in-depth article on Debug vs. Release - Surviving the Release Version[^]


我有类似的问题在Release版本的Debug和Crash中很好。 Atlast我发现一些整数变量在Debug模式下自动初始化为0。相同的变量在Release模式下带有一些垃圾值。在初始化正确的值后,它对我来说很好。



请检查你的变量m_hMDIMenu,m_hMDIAccel在调试版和发布版中都保持相同的期望值。可能是一个原因!
I had similar problem of something works fine in Debug and Crash in Release version. Atlast i found some integer variables are automatically initizlized to 0 in Debug mode. The same variables carry some junk value in Release mode. After initilizing proper values, it went fine for me.

please check your variables m_hMDIMenu, m_hMDIAccel holds the same expected values in both debug and release version. may be a reason !


这篇关于发行版本出现意外行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆