Fix changing the CC of a function (#3067)

The QByteArray must be kept alive as long as its contens are used. Also
in this function, Core()->renameFunction() is not used to avoid sending
multiple signals for a single edit action.
This commit is contained in:
Florian Märkl 2023-01-07 20:05:14 +01:00 committed by GitHub
parent 2d7fd02a62
commit ad82407c2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1023,18 +1023,15 @@ void DisassemblyContextMenu::on_actionEditFunction_triggered()
if (dialog.exec()) {
QString new_name = dialog.getNameText();
Core()->renameFunction(fcn->addr, new_name);
rz_core_analysis_function_rename(core, fcn->addr, new_name.toStdString().c_str());
QString new_start_addr = dialog.getStartAddrText();
fcn->addr = Core()->math(new_start_addr);
QString new_stack_size = dialog.getStackSizeText();
fcn->stack = int(Core()->math(new_stack_size));
const char *ccSelected = dialog.getCallConSelected().toUtf8().constData();
if (RZ_STR_ISEMPTY(ccSelected)) {
return;
}
if (rz_analysis_cc_exist(core->analysis, ccSelected)) {
fcn->cc = rz_str_constpool_get(&core->analysis->constpool, ccSelected);
QByteArray newCC = dialog.getCallConSelected().toUtf8();
if (!newCC.isEmpty() && rz_analysis_cc_exist(core->analysis, newCC.constData())) {
fcn->cc = rz_str_constpool_get(&core->analysis->constpool, newCC.constData());
}
emit Core()->functionsChanged();