cwFlowNet.cpp : Fixed bug where poly nets UI elements were not released.

Added and set ui_var_t.has_source_fl.
This commit is contained in:
kevin 2024-10-19 12:37:13 -04:00
parent 11489d89b4
commit 930982028d
2 changed files with 16 additions and 6 deletions

View File

@ -102,7 +102,7 @@ namespace cw
typedef struct ui_proc_desc_str typedef struct ui_proc_desc_str
{ {
const char* label; const char* label; // class label
ui_preset_t* presetA; // presetA[ presetN ] ui_preset_t* presetA; // presetA[ presetN ]
unsigned presetN; unsigned presetN;
} ui_proc_desc_t; } ui_proc_desc_t;
@ -111,14 +111,15 @@ namespace cw
typedef struct ui_var_str 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 const char* label; // flow::variable_t::label
unsigned label_sfx_id; // flow::variable_t::label_sfx_id unsigned label_sfx_id; // flow::variable_t::label_sfx_id
const object_t* desc_cfg; // var desc cfg from flow::var_desc_t const object_t* desc_cfg; // var desc cfg from flow::var_desc_t
unsigned desc_flags; // flow::var_desc_t::flags 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 value_tid; // flow::variable_t::type
unsigned vid; // flow::variable_t::vid unsigned vid; // flow::variable_t::vid
unsigned ch_idx; // flow::variable_t::chIdx unsigned ch_idx; // flow::variable_t::chIdx

View File

@ -132,12 +132,20 @@ namespace cw
for(unsigned i=0; i<ui_net->procN; ++i) for(unsigned i=0; i<ui_net->procN; ++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[i].varA);
} }
mem::release(ui_net->procA); mem::release(ui_net->procA);
mem::release(ui_net->presetA); mem::release(ui_net->presetA);
mem::release(ui_net); mem::release(ui_net);
return rc; return rc;
} }
@ -3110,6 +3118,7 @@ namespace cw
ui_var->ui_proc = ui_proc; ui_var->ui_proc = ui_proc;
ui_var->label = var->label; ui_var->label = var->label;
ui_var->label_sfx_id = var->label_sfx_id; 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->vid = var->vid;
ui_var->ch_cnt = var_channel_count( net.procA[i], var->label, var->label_sfx_id ); ui_var->ch_cnt = var_channel_count( net.procA[i], var->label, var->label_sfx_id );
ui_var->ch_idx = var->chIdx; ui_var->ch_idx = var->chIdx;
@ -3132,7 +3141,7 @@ namespace cw
ui_net_ref->presetA = mem::allocZ<ui_preset_t>(net.presetN); ui_net_ref->presetA = mem::allocZ<ui_preset_t>(net.presetN);
ui_net_ref->presetN = net.presetN; ui_net_ref->presetN = net.presetN;
for(unsigned i=0; i<ui_net_ref->presetN; ++i) for(unsigned i=0; i<ui_net_ref->presetN; ++i)
{ {
ui_net_ref->presetA[i].label = net.presetA[i].label; ui_net_ref->presetA[i].label = net.presetA[i].label;