From 930982028d7d8c832f3b2dcca373e69e9cfd81a6 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 19 Oct 2024 12:37:13 -0400 Subject: [PATCH] cwFlowNet.cpp : Fixed bug where poly nets UI elements were not released. Added and set ui_var_t.has_source_fl. --- cwFlowDecl.h | 7 ++++--- cwFlowNet.cpp | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/cwFlowDecl.h b/cwFlowDecl.h index 1392559..6ec73fb 100644 --- a/cwFlowDecl.h +++ b/cwFlowDecl.h @@ -102,7 +102,7 @@ namespace cw typedef struct ui_proc_desc_str { - const char* label; + const char* label; // class label ui_preset_t* presetA; // presetA[ presetN ] unsigned presetN; } ui_proc_desc_t; @@ -111,14 +111,15 @@ namespace cw typedef struct ui_var_str { - struct ui_proc_str* ui_proc; + struct ui_proc_str* ui_proc; // owning proc const char* label; // flow::variable_t::label unsigned label_sfx_id; // flow::variable_t::label_sfx_id const object_t* desc_cfg; // var desc cfg from flow::var_desc_t unsigned desc_flags; // flow::var_desc_t::flags - + + bool has_source_fl; // true if this var is connected to a source var unsigned value_tid; // flow::variable_t::type unsigned vid; // flow::variable_t::vid unsigned ch_idx; // flow::variable_t::chIdx diff --git a/cwFlowNet.cpp b/cwFlowNet.cpp index 4fd94fd..06aec55 100644 --- a/cwFlowNet.cpp +++ b/cwFlowNet.cpp @@ -132,12 +132,20 @@ namespace cw for(unsigned i=0; iprocN; ++i) { + ui_net_t* iun = ui_net->procA[i].internal_net; + while( iun!=nullptr ) + { + ui_net_t* iun0 = iun->poly_link; + _destroy_ui_net(iun); + iun = iun0; + } + mem::release(ui_net->procA[i].varA); + } + mem::release(ui_net->procA); mem::release(ui_net->presetA); - - mem::release(ui_net); return rc; } @@ -3110,6 +3118,7 @@ namespace cw ui_var->ui_proc = ui_proc; ui_var->label = var->label; ui_var->label_sfx_id = var->label_sfx_id; + ui_var->has_source_fl= is_connected_to_source( var ); ui_var->vid = var->vid; ui_var->ch_cnt = var_channel_count( net.procA[i], var->label, var->label_sfx_id ); ui_var->ch_idx = var->chIdx; @@ -3132,7 +3141,7 @@ namespace cw ui_net_ref->presetA = mem::allocZ(net.presetN); ui_net_ref->presetN = net.presetN; - + for(unsigned i=0; ipresetN; ++i) { ui_net_ref->presetA[i].label = net.presetA[i].label;