Skip to content

Commit e69a007

Browse files
YappaXVilka
Yappa
authored andcommitted
Fix "New Function" Dialog (rizinorg#3102)
1 parent 68ec5a3 commit e69a007

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/menus/DisassemblyContextMenu.cpp

+14-8
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,7 @@ void DisassemblyContextMenu::addDebugMenu()
314314
QVector<DisassemblyContextMenu::ThingUsedHere> DisassemblyContextMenu::getThingUsedHere(RVA offset)
315315
{
316316
RzCoreLocked core(Core());
317-
auto p = fromOwned(
318-
rz_core_analysis_name(core, offset), rz_core_analysis_name_free);
317+
auto p = fromOwned(rz_core_analysis_name(core, offset), rz_core_analysis_name_free);
319318
if (!p) {
320319
return {};
321320
}
@@ -799,7 +798,6 @@ void DisassemblyContextMenu::on_actionAddComment_triggered()
799798

800799
void DisassemblyContextMenu::on_actionAnalyzeFunction_triggered()
801800
{
802-
bool ok;
803801
RVA flagOffset;
804802
QString name = Core()->nearestFlag(offset, &flagOffset);
805803
if (name.isEmpty() || flagOffset != offset) {
@@ -812,12 +810,20 @@ void DisassemblyContextMenu::on_actionAnalyzeFunction_triggered()
812810
}
813811

814812
// Create dialog
815-
QString functionName =
816-
QInputDialog::getText(this, tr("New function at %1").arg(RzAddressString(offset)),
817-
tr("Function name:"), QLineEdit::Normal, name, &ok);
813+
QInputDialog inputDialog(this->mainWindow);
814+
inputDialog.resize(500, 100);
815+
inputDialog.setWindowTitle(tr("New function at %1").arg(RzAddressString(offset)));
816+
inputDialog.setLabelText(tr("Function name:"));
817+
inputDialog.setTextValue(name);
818+
inputDialog.setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint);
819+
820+
if (inputDialog.exec() != QDialog::Accepted) {
821+
return;
822+
}
823+
824+
QString functionName = inputDialog.textValue().trimmed();
818825

819-
// If user accepted
820-
if (ok && !functionName.isEmpty()) {
826+
if (!functionName.isEmpty()) {
821827
Core()->createFunctionAt(offset, functionName);
822828
}
823829
}

0 commit comments

Comments
 (0)