Bubblegum Engine error

Started by
15 comments, last by GlennLatomme 12 years, 3 months ago
Something is not going to work.

Your Initialize() method is returning an integer. 'SUCCEEDED' don't check that.
You can do this:
if( engine.Initialize() ) // this automatically gives a 0 == true
{
engine.ProgramLoop();
}

Or you can do this:
HRESULT Initialize()
{
HRESULT hr;

// Initialize the engine

return hr;
}
Advertisement

Something is not going to work.

Your Initialize() method is returning an integer. 'SUCCEEDED' don't check that.
You can do this:
if( engine.Initialize() ) // this automatically gives a 0 == true
{
engine.ProgramLoop();
}

Or you can do this:
HRESULT Initialize()
{
HRESULT hr;

// Initialize the engine

return hr;
}


Got some questions with that.
as you could see i did try { } catch { }
so if it wasn't succesfull it would go to quitwithError(), witch will exit the programm, so if it returns a value it must be a succsessfull creation.

and I tried adding the HRESULT, but it say's that is wasn't initialized
But i wouldn't know what value to put in the hr.
[quote name='Koenig, Frederick']"We tend to forget that happiness doesn't come as a result of getting something we don't have, but rather of recognizing and appreciating what we do have"[/quote]
If you use try - catch and exit when it fails, you don't need to return anything. You don't need to check if the initialization was succeeded because if it wasn't you would already have exited the application.

If you want to keep that try - catch, don't return anything because the return is useless.


If you want to use the HRESULT, here is an example of using it:

HRESULT hr;
hr = RegisterClass( &wndClass ); // this should work :P
return hr;

The value that will be put into hr depends: HRESULT values

If you use try - catch and exit when it fails, you don't need to return anything. You don't need to check if the initialization was succeeded because if it wasn't you would already have exited the application.

If you want to keep that try - catch, don't return anything because the return is useless.


If you want to use the HRESULT, here is an example of using it:

HRESULT hr;
hr = RegisterClass( &wndClass ); // this should work :P
return hr;

The value that will be put into hr depends: HRESULT values

Thanks,
but i still have my error: here
[quote name='Koenig, Frederick']"We tend to forget that happiness doesn't come as a result of getting something we don't have, but rather of recognizing and appreciating what we do have"[/quote]
0xFEEEFEEE is the fill MSVC uses when something is freed. i.e. it's trying to delete something that has already been deleted.

A quick glance at the code shows the AGame pointer is deleted both outside the class (in main) and in the destructor for the MainEngine class - which is probably the issue...

Jans.
I can see you are deleting the object in the destructor of the MainEngine. And thereafter you delete the same object again at the end of the WinMain..

0xFEEEFEEE is the fill MSVC uses when something is freed. i.e. it's trying to delete something that has already been deleted.

A quick glance at the code shows the AGame pointer is deleted both outside the class (in main) and in the destructor for the MainEngine class - which is probably the issue...

Jans.


Hmm now you say it, the m_abstractGamePtr is just a pointer not a new object, so I didn't have to delete it, thx!
[quote name='Koenig, Frederick']"We tend to forget that happiness doesn't come as a result of getting something we don't have, but rather of recognizing and appreciating what we do have"[/quote]

This topic is closed to new replies.

Advertisement