我是 Qt 的新手。所以我开始重新实现一个入门示例:链接。
但是,我在关闭窗口时收到 SIGABRT 信号。其原因显然是由于一些内存管理错误。
您可以在下面找到调用堆栈和相关代码。该行editWindow.setLayout(&layout);
导致错误。布局类是否在销毁时删除小部件,从而声称拥有它们?
这种行为的原因是什么?以及如何解决?
最好的祝福。
信息
调用栈
来源
QPushButton testButton("Test");
QVBoxLayout layout;
layout.addWidget(&testButton);
QWidget editWindow;
// the following line is the source of the error
editWindow.setLayout(&layout);
editWindow.show();
int val = app.exec();