Skip to content

在MacOS中带有代理的窗口里创建新的窗口,销毁第二个窗口时会crash #20

@schindleren

Description

@schindleren

MacOS下,我有一个带有QWK::WidgetWindowAgent代理的窗口A,在其中再创建一个带有代理的窗口B。销毁窗口B的时候,会crash。
代码如下:
WinKitTest::WinKitTest(QWidget *parent)
: QWidget(parent)
, ui(new Ui::WinKitTest)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);

// frameless agent
m_windowAgent = new QWK::WidgetWindowAgent(this);
m_windowAgent->setup(this);
m_windowAgent->setTitleBar(ui->label);
m_windowAgent->setSystemButton(QWK::WindowAgentBase::Close, ui->pushButton);
m_windowAgent->setHitTestVisible(ui->pushButton_2);

}

WinKitTest::~WinKitTest()
{
delete ui;
qDebug() << "DDDDDDDDDDDDDD";
}

void WinKitTest::on_pushButton_2_clicked()
{
(new WinKitTest())->show();
}

void WinKitTest::on_pushButton_clicked()
{
close();
}

按下pushButton_2创建一个新的WinKitTest。
按下新的WinKitTest中的pushButton,程序就崩溃了。
堆栈如图:
截屏2024-01-05 17 15 27

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions