Hi got a tiny question about app.cpp.
Why this?
void CodeBlocksApp::HideSplashScreen()
{
if (m_pSplash)
delete m_pSplash;
m_pSplash = 0;
}
I belive it should be this....
void CodeBlocksApp::HideSplashScreen()
{
if (m_pSplash)
{
delete m_pSplash;
m_pSplash = 0;
}
}
It seems to me that m_pSplash is getting set to 0 unnessecarily.....
Patch below fixes the problem (I think)..... :lol:
[attachment deleted by admin]
Actually, it's perfectly OK to delete a null pointer. So maybe it should be
void CodeBlocksApp::HideSplashScreen()
{
delete m_pSplash;
if (m_pSplash)
m_pSplash = 0;
}
?
However, checking the if probably takes more time than the assignment would take, so
void CodeBlocksApp::HideSplashScreen()
{
delete m_pSplash;
m_pSplash = 0;
}
is probably even better.
If you don't zero the pointer after deleting, you may delete it twice (as HideSplashScreen can be called more often than once).
All these versions set the pointer to null after a delete (except the first one above, but only if it was already null).
Deleting the same object twice is a MCA.
MCA?