diff options
author | B. Watson <urchlay@slackware.uk> | 2024-01-10 13:46:06 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-01-10 13:46:06 -0500 |
commit | a47bf6ed4f186f41693e186bf107cf51ada4d5ae (patch) | |
tree | 2f0dc9e70c74b2ac2d3878e1a6442af3c2c3bd89 | |
parent | 4eaf25bc5394fb1f9f23403130e48c016f3a89fa (diff) | |
download | hcalc-a47bf6ed4f186f41693e186bf107cf51ada4d5ae.tar.gz |
Clean up memory leak when changing window size.
-rw-r--r-- | hcalc.h | 3 | ||||
-rw-r--r-- | input.c | 2 | ||||
-rw-r--r-- | setupx.c | 8 |
3 files changed, 10 insertions, 3 deletions
@@ -53,9 +53,10 @@ void button(int b, int x, int y); void complete_paste(unsigned char *s, int n); void send_current_display(void); void setup_x(void); +void shutdown_x(void); void free_pixmaps(void); void load_pixmaps(void); -void process_input(); +void process_input(void); void load_config(void); void save_config(void); void show_value(void); @@ -433,7 +433,7 @@ void key(char c) { winsize++; if(winsize == 3) winsize = 0; free_pixmaps(); - XCloseDisplay(display); + shutdown_x(); setup_x(); load_pixmaps(); show_value(); @@ -92,7 +92,13 @@ void setup_x(void) { bit_off = color.pixel; } -void process_input() { +void shutdown_x(void) { + XDestroyWindow(display, window); + XFreeGC(display, gc); + XCloseDisplay(display); +} + +void process_input(void) { char c; KeySym keysym; XTextProperty tprop; |