wslua: Fix logger after g6a5e90f2
The Qt log output changes in g6a5e90f2 changed the Qt message handler to use g_log. Lua logging already used g_log. The Qt variant of funnel logger, which is used by Lua as g_log backend, is currently using qDebug and this gives recursive calls to g_log and thus an assert. Rewrite the lua logging to not use g_log. Change-Id: Icf4f0022a11cb32d2b4f413f76d946f2506e283d Reviewed-on: https://code.wireshark.org/review/24888 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
5b596fa871
commit
c9b6887d84
|
@ -53,6 +53,7 @@ static lua_State* L = NULL;
|
|||
packet_info* lua_pinfo;
|
||||
struct _wslua_treeitem* lua_tree;
|
||||
tvbuff_t* lua_tvb;
|
||||
wslua_logger_t wslua_logger;
|
||||
int lua_dissectors_table_ref = LUA_NOREF;
|
||||
int lua_heur_dissectors_table_ref = LUA_NOREF;
|
||||
|
||||
|
@ -879,17 +880,11 @@ void wslua_init(register_cb cb, gpointer client_data) {
|
|||
if (first_time) {
|
||||
ws_lua_ei = ei;
|
||||
ws_lua_ei_len = array_length(ei);
|
||||
|
||||
/* set up the logger */
|
||||
g_log_set_handler(LOG_DOMAIN_LUA, (GLogLevelFlags)(G_LOG_LEVEL_CRITICAL|
|
||||
G_LOG_LEVEL_WARNING|
|
||||
G_LOG_LEVEL_MESSAGE|
|
||||
G_LOG_LEVEL_INFO|
|
||||
G_LOG_LEVEL_DEBUG),
|
||||
ops ? ops->logger : basic_logger,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* set up the logger */
|
||||
wslua_logger = ops ? ops->logger : basic_logger;
|
||||
|
||||
if (!L) {
|
||||
L = lua_newstate(wslua_allocf, NULL);
|
||||
}
|
||||
|
|
|
@ -67,6 +67,9 @@
|
|||
#define WSLUA_PREFS_CHANGED "prefs_changed"
|
||||
#define LOG_DOMAIN_LUA "wslua"
|
||||
|
||||
typedef void (*wslua_logger_t)(const gchar *, GLogLevelFlags, const gchar *, gpointer);
|
||||
extern wslua_logger_t wslua_logger;
|
||||
|
||||
/* type conversion macros - lua_Number is a double, so casting isn't kosher; and
|
||||
using Lua's already-available lua_tointeger() and luaL_checkinteger() might be different
|
||||
on different machines; so use these instead please! */
|
||||
|
|
|
@ -160,7 +160,7 @@ static int wslua_log(lua_State* L, GLogLevelFlags log_level) {
|
|||
lua_pop(L, 1); /* pop result */
|
||||
}
|
||||
|
||||
g_log(LOG_DOMAIN_LUA, log_level, "%s\n", str->str);
|
||||
wslua_logger(LOG_DOMAIN_LUA, log_level, "%s\n", str->str);
|
||||
g_string_free(str,TRUE);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue