From be47690f5cb1c0d3045833efc5a2c853a7fe44a6 Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 15 Apr 2016 16:11:23 +0200 Subject: [PATCH] Remove the buffer when hiding the cvar list --- qcsrc/menu/xonotic/cvarlist.qc | 10 +++++++++- qcsrc/menu/xonotic/cvarlist.qh | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/qcsrc/menu/xonotic/cvarlist.qc b/qcsrc/menu/xonotic/cvarlist.qc index e41223277..74d85ca04 100644 --- a/qcsrc/menu/xonotic/cvarlist.qc +++ b/qcsrc/menu/xonotic/cvarlist.qc @@ -46,9 +46,17 @@ void XonoticCvarList_showNotify(entity me) if(force_initial_selection) me.setSelected(me, 0); } +void XonoticCvarList_hideNotify(entity me) +{ + if(me.handle) + buf_del(me.handle); + me.handle = buf_create(); + me.nItems = 0; +} void XonoticCvarList_destroy(entity me) { - buf_del(me.handle); + if(me.handle) + buf_del(me.handle); } string autocvar_menu_forced_saved_cvars; string autocvar_menu_reverted_nonsaved_cvars; diff --git a/qcsrc/menu/xonotic/cvarlist.qh b/qcsrc/menu/xonotic/cvarlist.qh index 11ab45f35..2c99866cf 100644 --- a/qcsrc/menu/xonotic/cvarlist.qh +++ b/qcsrc/menu/xonotic/cvarlist.qh @@ -8,6 +8,7 @@ CLASS(XonoticCvarList, XonoticListBox) METHOD(XonoticCvarList, resizeNotify, void(entity, vector, vector, vector, vector)); METHOD(XonoticCvarList, keyDown, float(entity, float, float, float)); METHOD(XonoticCvarList, showNotify, void(entity)); + METHOD(XonoticCvarList, hideNotify, void(entity)); METHOD(XonoticCvarList, destroy, void(entity)); -- 2.39.2