CMakePM: Fix possible crash on exit

The pathchooser might get deleted after the inner line
edit had been destroyed already (as its ownership was
transferred to the layout of the CMake build settings
widget.

Partially reverts 314ceb13bc.

Change-Id: I3ff990af55ed08978d9f0c079c4b98a019a6ec87
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Christian Stenger
2020-02-05 15:36:01 +01:00
parent 54cd881a40
commit 43c17efe5e

View File

@@ -107,7 +107,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
auto project = bc->project();
auto buildDirChooser = new Utils::PathChooser(this);
auto buildDirChooser = new Utils::PathChooser;
buildDirChooser->setBaseDirectory(project->projectDirectory());
buildDirChooser->setFileName(bc->buildDirectory());
connect(buildDirChooser, &Utils::PathChooser::rawPathChanged, this,
@@ -118,8 +118,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
int row = 0;
mainLayout->addWidget(new QLabel(tr("Build directory:")), row, 0);
mainLayout->addWidget(buildDirChooser->lineEdit(), row, 1);
mainLayout->addWidget(buildDirChooser->buttonAtIndex(0), row, 2);
mainLayout->addWidget(buildDirChooser, row, 1, 1, 2);
++row;
auto qmlDebugAspect = bc->aspect<QtSupport::QmlDebuggingAspect>();