From e3ab569f35cc0e509d8efa761dbdc3f2daf26ed2 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Sat, 4 Dec 2021 01:45:26 +0100 Subject: [PATCH] fix: xctx->inst_redraw_table can not be static, must be dinamically allocated. --- src/move.c | 8 +++++++- src/xinit.c | 4 +++- src/xschem.h | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/move.c b/src/move.c index fee089c4..532a22d3 100644 --- a/src/move.c +++ b/src/move.c @@ -487,11 +487,13 @@ void find_inst_to_be_redrawn(int what) int i, n, p, rects; xSymbol * sym; xInstance * const inst = xctx->inst; + int s_pnetname = tclgetboolvar("show_pin_net_names"); dbg(1,"find_inst_to_be_redrawn(): what=%d\n", what); if(what & 16) { - memset(xctx->inst_redraw_table, 0, HASHSIZE * sizeof(unsigned char)); + my_free(1202, &xctx->inst_redraw_table); + xctx->inst_redraw_table_size = 0; int_hash_free(xctx->node_redraw_table); return; } @@ -521,6 +523,10 @@ void find_inst_to_be_redrawn(int what) } } /* if(!(what & 8)) */ + if(!xctx->inst_redraw_table || xctx->instances > xctx->inst_redraw_table_size) { + my_realloc(1203, &xctx->inst_redraw_table, xctx->instances * sizeof(unsigned char)); + xctx->inst_redraw_table_size = xctx->instances; + } for(i=0; i < xctx->instances; i++) { sym = xctx->inst[i].ptr + xctx->sym; rects = sym->rects[PINLAYER]; diff --git a/src/xinit.c b/src/xinit.c index f2a39d39..6a344516 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -367,6 +367,7 @@ void free_xschem_data() my_free(1121, &xctx->active_layer); my_free(1295, &xctx->top_path); my_free(1120, &xctx->fill_type); + if(xctx->inst_redraw_table) my_free(604, &xctx->inst_redraw_table); my_free(269, &xctx); } @@ -456,7 +457,8 @@ void alloc_xschem_data(const char *top_path) memset(xctx->node_table, 0, HASHSIZE * sizeof(struct node_hashentry *)); memset(xctx->hilight_table, 0, HASHSIZE *sizeof(struct hilight_hashentry *)); memset(xctx->node_redraw_table, 0, HASHSIZE * sizeof(struct int_hashentry *)); - memset(xctx->inst_redraw_table, 0, HASHSIZE * sizeof(unsigned char)); + xctx->inst_redraw_table = NULL; + xctx->inst_redraw_table_size = 0; xctx->window = xctx->save_pixmap = 0; xctx->xrect[0].width = xctx->xrect[0].height = xctx->xrect[0].x = xctx->xrect[0].y = 0; xctx->xschem_w = xctx->xschem_h = 0; diff --git a/src/xschem.h b/src/xschem.h index beefd45d..0f39b32f 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -637,7 +637,8 @@ typedef struct { /* list of nodes, instances attached to these need redraw */ struct int_hashentry *node_redraw_table[HASHSIZE]; /* list of instances, collected using previous table, that need redraw */ - unsigned char inst_redraw_table[HASHSIZE]; + unsigned char *inst_redraw_table; + int inst_redraw_table_size; double rx1, rx2, ry1, ry2; short move_rot; short move_flip;