Jump to content
  • Advertisement
nakwonelec

Throw exception after launch

Recommended Posts

Hello,

recently, -i don't know from when- BMFont crash right after launch.

I figure out why,

void CCharWin::DrawGlyphs(HDC dc, RECT &rc, TEXTMETRIC &tm)
{
   int offset = 0, charEnd = 255;
	if (fontGen->IsUsingUnicode())
	{
		const SSubset *subset = fontGen->GetUnicodeSubset(unicodeSubset);
		offset = subset->charBegin; // <-- throw exception because subset is zero
		charEnd = subset->charEnd;
	}
  ...
}

subset should be -i guess- initialized in CCharwin::Create(width, height, configFile) before Draw();

int WINAPI WinMain(HINSTANCE hInst, 
				   HINSTANCE hPrevInst, 
				   LPSTR     cmdLine, 
				   int       showFlag)
{
	// Turn on memory leak detection
	// Find the memory leak with _CrtSetBreakAlloc(n) where n is the number reported
	_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF);
	_CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE);
	_CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR);

	Init();

	string configFile;
	int result = 0;
	bool openGui = processCmdLine(cmdLine, configFile, result);

	if( openGui )
	{
		CCharWin *wnd = new CCharWin(512, 512, configFile);
		wnd->Create();
        ....
    }
    ...
}
LRESULT CCharWin::MsgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
    ...
    switch( msg )
    {
	case WM_PAINT:
		Draw();
		return 0;
    ...
}

But, suddenly execute priority is changed.

It occur both in v1.13 and v1.14 beta.

When, If execute binary(bmfont.exe) in cmd(prompt), run correctly.

Please figure out.

Thanks.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!