SplashScreen -- deleting the image


Shouldn’t the SplashScreen destructor do this:SplashScreen::~SplashScreen() { delete backgroundImage; }since the most common way of creating the splash is probably:

Otherwise, you would have to keep the image allocated somewhere and delete it at program end – rather inconvenient if one is using the splash in an About box as well.


void SplashScreen::mouseDown(const MouseEvent& e) { delete this; }would be really nice to have too.

  • kbj


yes, good point, although ImageCache::release would be the correct way to delete the image, in case they’re using a shared image.

Not sure you’d want a click to get rid of the splash screen though - the point of it being there is to let you know that the app’s alive and running.


The two places I would normally do a splash are at the program initialization and in the about box. The about box should use a mouse click to go away, while the program initialization splash could use one to dismiss the splash early. In my program, I have a gui front end that connects to an audio engine. The gui pops up really fast, so the splash hangs around too long. There is a project requirement for a splash screen, so I can’t just put in a settings checkbox for splash/no splash. Of course it’s easy enough to subclass that myself, so I’m not complaining or anything like that. This is just the way I use things, so it may be helpful to know that.

BTW, I haven’t forgotten about sending you my network code. I’ve got a major deadline coming up next week and haven’t had time to spruce things up for you, so it will have to wait.

  • kbj