In Win 7 - "Fault Module Name: Qt5Cored.dll and APPCRASH" error, and in centos 6.4 running application error is : "signal name : SIGSEGV signal
-
hi to all,
I created two dialogs "listdialog.ui" and "editdialog.ui" using QtDesigner, shipped
with Qt5.3.1, and then added to project "phone book.pro" "with source code" using
wizard.
Everytime I start my compiled phone book.exe with all needed dll’s, when i try
to start the program in the QtCreator (or individually), There comes an Runtime
Error with some problem details and there it says:Problem Event Name: APPCRASH
Fault Module Name: Qt5Cored.dllother programms which uses GUI are fine working(earlier complied .exe files).
Also when debugging(in win7) ( and running in centos6.4 ) it displays a message box :-The inferior stopped because it recieved a signal from the operating system.
signal name : SIGSEGV
signal meaning : segmentation faultfiles codes are :-
file - 1 : Editdialog.cpp :-
@
#include <QDialog>
#include "ui_EditDialog.h"class EditDialog : public QDialog, public Ui::EditDialog { public : EditDialog (QWidget *parent=0 ); const QString name() const; void setName( const QString& ); const QString number() const; void setNumber( const QString& ); private : EditDialog *ui; };
@
file - 2 : listdialog.h
@
#ifndef LISTDIALOG_H
#define LISTDIALOG_H#include <QDialog> #include "ui_ListDialog.h" class ListDialog : public QDialog, public Ui::ListDialog { Q_OBJECT public : //ListDialog(QObject *parent = 0); ListDialog(QWidget *parent = 0); //I don't know when to write "QWidget *parent=0" and when "QObject *parent=0) private slots : void addItem(); void editItem(); void deleteItem(); private : ListDialog *ui; }; #endif //LISTDIALOG_H
@
file - 3 : ListDialog.cpp
@
#include "ListDialog.h"
#include "EditDialog.h"ListDialog::ListDialog(QWidget *parent) : QDialog(parent), ui(new ListDialog) { ui->setupUi(this); connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addItem()) ); connect(ui->editButton, SIGNAL(clicked()), this, SLOT(editItem()) ); connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteItem()) ); } void ListDialog::addItem() { //EditDialog *dlg = EditDialog(this); EditDialog dlg(this); if(QDialog::Accepted == dlg.exec()) ui->listDialogWidget->addItem(dlg.name() + " -- " + dlg.number()); } void ListDialog::deleteItem() { delete ui->listDialogWidget->currentItem(); } void ListDialog::editItem() { if(!ui->listDialogWidget->currentItem()) return; QStringList parts = ui->listDialogWidget->currentItem()->text().split("--"); EditDialog dlg(this); dlg.setName(parts[0].trimmed()); dlg.setNumber(parts[1].trimmed()); if(dlg.exec() == QDialog::Accepted) ui->listDialogWidget->currentItem()->setText(dlg.name() + " -- " + dlg.number()); }
@
file - 4 : EditDialog.cpp
@
#include "EditDialog.h"
EditDialog :: EditDialog(QWidget *parent) : QDialog(parent)
{
ui->setupUi(this);
}const QString EditDialog::name() const { return ui->nameLineEdit->text().replace("--","").trimmed(); } void EditDialog::setName(const QString &name) { ui->nameLineEdit->setText(name); } const QString EditDialog::number() const { return ui->numberLineEdit->text().replace("--","").trimmed(); } void EditDialog::setNumber(const QString &number) { ui->numberLineEdit->setText(number); }
@
Along with them project has :- "ui_editdialog.h" and "ui_listdialog.h" generated by QtDesigner.
file - 5 : main.cpp@
#include "EditDialog.h"
#include "ListDialog.h"
#include "mainwindow.h"
#include <QApplication>int main(int argc, char *argv[]) { QApplication a(argc, argv); //QObject parent; QWidget parent; /* ListDialog *listdlg = new ListDialog; listdlg->show(); */ ListDialog dlg(&parent); dlg.show(); return a.exec(); }
@
please any one tell me - how to overcome this problem. I searched in some sites
that this is a problem of pointer which is set to null or memory accessing outside
of its domain. I think it may be *parent=0 set by constructor ( file - 2 : listdialog.h -
ListDialog(QWidget *parent = 0); ) but how to overcome, I don't know. -
Hi,
It's not the parenting that is the problem. The first thing to do is run your application through the debugger to identify where exactly it crashes.