Fix empty parameter dialog in DriveSetup

* When the add-on provides no parameter editor, still add the set of
  of default controls instead of just bailing out of the Init()
  method.

* Before, DriveSetup never added the default controls in such cases
  and simply showed an empty window. This happened when e.g. trying
  to create a new partition inside an extended partition (because
  ExtendedPartitionAddOn provides no parameter editor).

* Fixes #10569
This commit is contained in:
Julian Harnath 2014-03-08 23:18:27 +01:00
parent 5d98ee1e4d
commit 119bf0013c

View File

@ -97,7 +97,7 @@ AbstractParametersPanel::~AbstractParametersPanel()
delete_sem(fExitSemaphore);
if (fEditor == NULL)
if (fOkButton->Window() == NULL)
delete fOkButton;
}
@ -171,14 +171,15 @@ AbstractParametersPanel::Init(B_PARAMETER_EDITOR_TYPE type,
if (status != B_OK && status != B_NOT_SUPPORTED)
fReturnStatus = status;
if (fEditor == NULL)
return;
// Create controls
BLayoutBuilder::Group<> builder = BLayoutBuilder::Group<>(this,
B_VERTICAL);
AddControls(builder, fEditor->View());
if (fEditor == NULL)
AddControls(builder, NULL);
else
AddControls(builder, fEditor->View());
builder.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
.AddGlue()
@ -189,8 +190,10 @@ AbstractParametersPanel::Init(B_PARAMETER_EDITOR_TYPE type,
SetDefaultButton(fOkButton);
fEditor->SetTo(partition);
fEditor->SetModificationMessage(new BMessage(kParameterChanged));
if (fEditor != NULL) {
fEditor->SetTo(partition);
fEditor->SetModificationMessage(new BMessage(kParameterChanged));
}
}