|
@@ -506,13 +506,13 @@ bool ModuleWidget::pasteJsonAction(json_t* moduleJ) { |
|
|
engine::Module::jsonStripIds(moduleJ); |
|
|
engine::Module::jsonStripIds(moduleJ); |
|
|
|
|
|
|
|
|
json_t* oldModuleJ = toJson(); |
|
|
json_t* oldModuleJ = toJson(); |
|
|
|
|
|
DEFER({json_decref(oldModuleJ);}); |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
fromJson(moduleJ); |
|
|
fromJson(moduleJ); |
|
|
} |
|
|
} |
|
|
catch (Exception& e) { |
|
|
catch (Exception& e) { |
|
|
WARN("%s", e.what()); |
|
|
WARN("%s", e.what()); |
|
|
json_decref(oldModuleJ); |
|
|
|
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -520,7 +520,9 @@ bool ModuleWidget::pasteJsonAction(json_t* moduleJ) { |
|
|
history::ModuleChange* h = new history::ModuleChange; |
|
|
history::ModuleChange* h = new history::ModuleChange; |
|
|
h->name = "paste module preset"; |
|
|
h->name = "paste module preset"; |
|
|
h->moduleId = module->id; |
|
|
h->moduleId = module->id; |
|
|
|
|
|
json_incref(oldModuleJ); |
|
|
h->oldModuleJ = oldModuleJ; |
|
|
h->oldModuleJ = oldModuleJ; |
|
|
|
|
|
json_incref(moduleJ); |
|
|
h->newModuleJ = moduleJ; |
|
|
h->newModuleJ = moduleJ; |
|
|
APP->history->push(h); |
|
|
APP->history->push(h); |
|
|
return true; |
|
|
return true; |
|
|