mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-23 21:35:28 +00:00
Fix "New Function" Dialog (#3102)
This commit is contained in:
parent
68ec5a3da1
commit
e69a007b8f
@ -314,8 +314,7 @@ void DisassemblyContextMenu::addDebugMenu()
|
|||||||
QVector<DisassemblyContextMenu::ThingUsedHere> DisassemblyContextMenu::getThingUsedHere(RVA offset)
|
QVector<DisassemblyContextMenu::ThingUsedHere> DisassemblyContextMenu::getThingUsedHere(RVA offset)
|
||||||
{
|
{
|
||||||
RzCoreLocked core(Core());
|
RzCoreLocked core(Core());
|
||||||
auto p = fromOwned(
|
auto p = fromOwned(rz_core_analysis_name(core, offset), rz_core_analysis_name_free);
|
||||||
rz_core_analysis_name(core, offset), rz_core_analysis_name_free);
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -799,7 +798,6 @@ void DisassemblyContextMenu::on_actionAddComment_triggered()
|
|||||||
|
|
||||||
void DisassemblyContextMenu::on_actionAnalyzeFunction_triggered()
|
void DisassemblyContextMenu::on_actionAnalyzeFunction_triggered()
|
||||||
{
|
{
|
||||||
bool ok;
|
|
||||||
RVA flagOffset;
|
RVA flagOffset;
|
||||||
QString name = Core()->nearestFlag(offset, &flagOffset);
|
QString name = Core()->nearestFlag(offset, &flagOffset);
|
||||||
if (name.isEmpty() || flagOffset != offset) {
|
if (name.isEmpty() || flagOffset != offset) {
|
||||||
@ -812,12 +810,20 @@ void DisassemblyContextMenu::on_actionAnalyzeFunction_triggered()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create dialog
|
// Create dialog
|
||||||
QString functionName =
|
QInputDialog inputDialog(this->mainWindow);
|
||||||
QInputDialog::getText(this, tr("New function at %1").arg(RzAddressString(offset)),
|
inputDialog.resize(500, 100);
|
||||||
tr("Function name:"), QLineEdit::Normal, name, &ok);
|
inputDialog.setWindowTitle(tr("New function at %1").arg(RzAddressString(offset)));
|
||||||
|
inputDialog.setLabelText(tr("Function name:"));
|
||||||
|
inputDialog.setTextValue(name);
|
||||||
|
inputDialog.setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint);
|
||||||
|
|
||||||
// If user accepted
|
if (inputDialog.exec() != QDialog::Accepted) {
|
||||||
if (ok && !functionName.isEmpty()) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString functionName = inputDialog.textValue().trimmed();
|
||||||
|
|
||||||
|
if (!functionName.isEmpty()) {
|
||||||
Core()->createFunctionAt(offset, functionName);
|
Core()->createFunctionAt(offset, functionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user