Commit 25d190c9 authored by rswindell's avatar rswindell
Browse files

Fix issue reported by Va7aqd: when sub-boards were cut to the clipboard

(or deleted) or a group of sub-boards was deleted, and any of the deleted/cut
sub-boards belonged to a configured QWKnet hub, that QWKnet sub-board would
end-up pointing to the next sub-board in the configuration (possibly in another
message group, possibly not part of the QWKnet in question). Now, if a
QWKnet sub is deleted/cut, remove it (correctly) from any QWKnet hubs using
a common (new) function: remove_sub(). The bug was: the remaining sub-board
pointers were moved *before* the remove-sub pointer was compared against the
list of QWKnet hub subs (and NULLed), so while the effort *was* made to address
this problem, it didn't actually work in practice. Thanks for the bug report.
parent 57e640d9
......@@ -144,6 +144,7 @@ int bits(long l);
void getar(char *desc, char *ar);
bool new_sub(unsigned new_subnum, unsigned group_num);
bool new_qhub_sub(qhub_t*, unsigned qsubnum, sub_t*, unsigned confnum);
void remove_sub(scfg_t*, unsigned subnum);
void sort_subs(int grpnum);
void sort_dirs(int libnum);
unsigned subs_in_group(unsigned grpnum);
......@@ -526,17 +526,7 @@ void msgs_cfg()
if (msk == MSK_DEL) {
for (j = 0; j < cfg.total_subs;) {
if (cfg.sub[j]->grp == grpnum) { /* delete subs of this group */
k = j;
while (k < cfg.total_subs) { /* move all subs down */
cfg.sub[k] = cfg.sub[k + 1];
for (q = 0; q < cfg.total_qhubs; q++)
for (s = 0; s < cfg.qhub[q]->subs; s++)
if (cfg.qhub[q]->sub[s] == cfg.sub[j])
cfg.qhub[q]->sub[s] = NULL;
remove_sub(&cfg, j);
else j++;
......@@ -95,13 +95,29 @@ bool new_sub(unsigned new_subnum, unsigned group_num)
return true;
void remove_sub(scfg_t* cfg, unsigned subnum)
sub_t* sub = cfg->sub[subnum];
// Remove the sub-board from any QWKnet hub sub-boards
for (unsigned q = 0; q < cfg->total_qhubs; q++) {
for (unsigned s = 0; s < cfg->qhub[q]->subs; s++) {
if (cfg->qhub[q]->sub[s] == sub)
cfg->qhub[q]->sub[s] = NULL;
for (unsigned i = subnum; i < cfg->total_subs; i++)
cfg->sub[i] = cfg->sub[i + 1];
void sub_cfg(uint grpnum)
static int dflt,tog_dflt,opt_dflt,net_dflt,adv_dflt,bar;
char str[128],str2[128],done=0,code[128];
char path[MAX_PATH+1];
char data_dir[MAX_PATH+1];
int j,m,n,ptridx,q,s;
int j,m,n,ptridx;
uint i,subnum[MAX_OPTS+1];
static sub_t savsub;
......@@ -291,15 +307,7 @@ void sub_cfg(uint grpnum)
if(msk == MSK_CUT)
savsub = *cfg.sub[subnum[i]];
for(s=0;s<cfg.qhub[q]->subs;s++) {
if(cfg.qhub[q]->sub[s] == cfg.sub[subnum[i]])
cfg.qhub[q]->sub[s] = NULL;
remove_sub(&cfg, subnum[i]);
uifc.changes = TRUE;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment