PDA

View Full Version : Someone want to join the OpenRcon project?



halvors
25th April 2010, 15:06
Hi!

Someone eant to join my opensource project OpenRcon?

http://sourceforge.net/projects/openrcon/

Halvor.

Lykurg
25th April 2010, 15:21
The forum "Qt-based Software" would have been a more suitable place for your query but anyway. I was curious how your code would look like, so I looked into it and must tell you that that kind of function is not a good idea:
void MainWindow::on_actionAbout_triggered()
{
menuHelp_About = new AboutDialog;
menuHelp_About->show();
} Why? Everytime this slot is called you create a new AboutDialog without deleting the old one. Result your application will block more and more memory. So you maybe better use
void MainWindow::on_actionAbout_triggered()
{
if (0 == menuHelp_About)
menuHelp_About = new AboutDialog;
menuHelp_About->show();
}

halvors
25th April 2010, 15:36
When i tryd this it got my application crashed! So what sould i do to get it work?

Lykurg
25th April 2010, 15:41
well, you must of course initialize menuHelp_About first. So your c-tor have to look like:
MainWindow::MainWindow(/*...*/) : QMainWindow(/*...*/), menuHelp_About(0)
{
//...
}or
MainWindow::MainWindow(/*...*/) : QMainWindow(/*...*/)
{
menuHelp_About = 0;
//...
}