Hi,
I have a program in which i create a new dialog. It doesn't happen every time i create that dialog, but when i close the dialog and create it again after enough attempts the program crashes.
I create the dialog from a mainwindow with the following code
void MainWindow::newServer()
{
serverScreen = new newServerScreen();
serverScreen->setParent(this);
serverScreen->setWindowFlags(Qt::Window);
serverScreen->setAttribute(Qt::WA_DeleteOnClose);
serverScreen->setAttribute(Qt::WA_ShowModal);
serverScreen->show();
}
void MainWindow::newServer()
{
serverScreen = new newServerScreen();
serverScreen->setParent(this);
serverScreen->setWindowFlags(Qt::Window);
serverScreen->setAttribute(Qt::WA_DeleteOnClose);
serverScreen->setAttribute(Qt::WA_ShowModal);
serverScreen->show();
}
To copy to clipboard, switch view to plain text mode
the code of the dialog is as follows
newServerScreen.h:
#ifndef NEWSERVERSCREEN_H
#define NEWSERVERSCREEN_H
#include <QDialog>
#include <QLineEdit>
#include <QCheckBox>
#include <QComboBox>
#include <QLabel>
#include <server.h>
class newServerScreen
: public QDialog{
public:
newServerScreen();
//Widgets
private:
void createInterface();
void createActions();
Server *newServer;
};
#endif // NEWSERVERSCREEN_H
#ifndef NEWSERVERSCREEN_H
#define NEWSERVERSCREEN_H
#include <QDialog>
#include <QLineEdit>
#include <QCheckBox>
#include <QComboBox>
#include <QLabel>
#include <server.h>
class newServerScreen : public QDialog
{
public:
newServerScreen();
//Widgets
QLineEdit *Addres;
QLineEdit *Nickname;
QLineEdit *Username;
QLineEdit *Password;
QCheckBox *UseSsl;
QCheckBox *RequireLogin;
QComboBox *Connections;
QLabel *labelAddres;
QLabel *labelNickname;
QLabel *labelUsername;
QLabel *labelPassword;
QLabel *labelConnections;
private:
void createInterface();
void createActions();
Server *newServer;
};
#endif // NEWSERVERSCREEN_H
To copy to clipboard, switch view to plain text mode
newServerScreen.cpp:
#include "newserverscreen.h"
newServerScreen::newServerScreen()
{
this->createActions();
this->createInterface();
}
void newServerScreen::createActions()
{
}
void newServerScreen::createInterface()
{
this->setWindowTitle(tr("Add new server"));
labelConnections
= new QLabel();
}
#include "newserverscreen.h"
newServerScreen::newServerScreen()
{
this->createActions();
this->createInterface();
}
void newServerScreen::createActions()
{
}
void newServerScreen::createInterface()
{
this->setWindowTitle(tr("Add new server"));
Addres = new QLineEdit();
Nickname = new QLineEdit();
Username = new QLineEdit();
Password = new QLineEdit();
UseSsl = new QCheckBox();
RequireLogin = new QCheckBox();
Connections = new QComboBox();
labelAddres = new QLabel();
labelNickname = new QLabel();
labelUsername = new QLabel();
labelPassword = new QLabel();
labelConnections = new QLabel();
}
To copy to clipboard, switch view to plain text mode
When i comment out all the lines with new in them in the newServerScreen.cpp file the program doesn't crash.
Once i got the following output from the program in QtCreator:
Starting O:/projects/Post_Program/debug/Post_Program.exe...
ASSERT: "r->d_func()->postedEvents >= 0" in file kernel\qcoreapplication.cpp, line 1235
Invalid parameter passed to C runtime function.
Invalid parameter passed to C runtime function.
QMutex::lock: Deadlock detected in thread
8976
Starting O:/projects/Post_Program/debug/Post_Program.exe...
ASSERT: "r->d_func()->postedEvents >= 0" in file kernel\qcoreapplication.cpp, line 1235
Invalid parameter passed to C runtime function.
Invalid parameter passed to C runtime function.
QMutex::lock: Deadlock detected in thread 8976
To copy to clipboard, switch view to plain text mode
I don't know what i did different that time because i can't replicate it.
I program in QtCreator 1.1.0 with Qt 4.5.1 on a Windows 7 RC 64bit
Thanks in advance
Bookmarks