From ecc4f756bdb6175cc0b3b11af2f90884db1c602c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Tue, 11 Aug 2015 14:08:08 +0200 Subject: Added Reload Lua plugins. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is initial support for reloading Lua plugins without restarting the application. Still todo: - Deregister FileHandlers - Support deregister ProtoField with existing abbrev (same_name_hfinfo) - Add a progress dialog when reloading many plugins - Search for memory leakages in wslua functions Change-Id: I48870d8741251705ca15ffe1068613fcb0cb18c1 Reviewed-on: https://code.wireshark.org/review/5028 Reviewed-by: Stig Bjørlykke --- epan/wslua/wslua_gui.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'epan/wslua/wslua_gui.c') diff --git a/epan/wslua/wslua_gui.c b/epan/wslua/wslua_gui.c index 0586293aa3..1fc3baeee7 100644 --- a/epan/wslua/wslua_gui.c +++ b/epan/wslua/wslua_gui.c @@ -121,8 +121,9 @@ WSLUA_FUNCTION wslua_register_menu(lua_State* L) { /* Register a menu item in o WSLUA_RETURN(0); } - - +void wslua_deregister_menus(void) { + funnel_deregister_menus(lua_menu_callback); +} struct _dlg_cb_data { lua_State* L; @@ -553,6 +554,20 @@ WSLUA_METHOD TextWindow_get_text(lua_State* L) { /* Get the text of the window * WSLUA_RETURN(1); /* The `TextWindow`'s text. */ } +WSLUA_METHOD TextWindow_close(lua_State* L) { /* Close the window */ + TextWindow tw = checkTextWindow(L,1); + + if (!ops->destroy_text_window) { + WSLUA_ERROR(TextWindow_get_text,"GUI not available"); + return 0; + } + + ops->destroy_text_window(tw->ws_tw); + tw->ws_tw = NULL; + + return 0; +} + /* Gets registered as metamethod automatically by WSLUA_REGISTER_CLASS/META */ static int TextWindow__gc(lua_State* L) { TextWindow tw = toTextWindow(L,1); @@ -666,7 +681,6 @@ WSLUA_METHOD TextWindow_add_button(lua_State* L) { WSLUA_METHODS TextWindow_methods[] = { WSLUA_CLASS_FNREG(TextWindow,new), WSLUA_CLASS_FNREG(TextWindow,set), - WSLUA_CLASS_FNREG(TextWindow,new), WSLUA_CLASS_FNREG(TextWindow,append), WSLUA_CLASS_FNREG(TextWindow,prepend), WSLUA_CLASS_FNREG(TextWindow,clear), @@ -674,6 +688,7 @@ WSLUA_METHODS TextWindow_methods[] = { WSLUA_CLASS_FNREG(TextWindow,set_editable), WSLUA_CLASS_FNREG(TextWindow,get_text), WSLUA_CLASS_FNREG(TextWindow,add_button), + WSLUA_CLASS_FNREG(TextWindow,close), { NULL, NULL } }; -- cgit v1.2.1