堆块在..修改为..过去要求的大小

时间:2016-10-19 08:30:45

标签: c++ qt heap

我尝试用Qt在另一个窗口中创建一个窗口并删除第一个窗口。当第二个窗口打开时,第一个窗口被删除但是当我尝试删除第二个窗口时出现此错误:

  

HEAP [Flash的测试平台客户端-Rev1-0.exe]:   18FBC298处的堆块在18FBC2C4处修改,超过所要求的24的大小

这是我的简化代码:

的main.cpp

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    ConnectionWindow *w = new ConnectionWindow;

    return a.exec();
}

connectionwindow.cpp

ConnectionWindow::ConnectionWindow(QWidget *parent)
    : QMainWindow(parent)
{
    QWidget *w = new QWidget;

    QVBoxLayout *l = new QVBoxLayout;

    QPushButton *button = new QPushButton;
    button->setText("Connect");
    conenect(button, SINGNAL(pressed()), this, (openW()));

    l->addWidget(button);
    w->setLayout(l);

    this->setCentralWidget(w);
    this->setAttribute(Qt::WA_DeleteOnClose);
    this->show;
}

void ConnectionWindow::openW(){
    MainWindow *window = new MainWindow;

    this->close;
}

mainwindow.cpp

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    QWidget *w = new QWidget;

    QVBoxLayout *l = new QVBoxLayout;

    QPushButton *button = new QPushButton;
    button->setText("Close");
    conenect(button, SINGNAL(pressed()), this, (closeW));

    l->addWidget(button);
    w->setLayout(l);

    this->setCentralWidget(w);
    this->setAttribute(Qt::WA_DeleteOnClose);
    this->show;
}

void MainWindow::closeW(){  
    this->close();
}

0 个答案:

没有答案