Change in osmocom-bb[master]: Forget about the callback after use and cancellation

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Aug 24 10:34:02 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10536 )

Change subject: Forget about the callback after use and cancellation
......................................................................

Forget about the callback after use and cancellation

Don't try to unref something else after we have given up our
spot in the table.

Change-Id: I4e8db297e816d3d07a46147d5d3bdc0e8fae6c9a
---
M src/host/layer23/src/mobile/script_lua.c
1 file changed, 5 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/host/layer23/src/mobile/script_lua.c b/src/host/layer23/src/mobile/script_lua.c
index 4cfe55a..088aab3 100644
--- a/src/host/layer23/src/mobile/script_lua.c
+++ b/src/host/layer23/src/mobile/script_lua.c
@@ -136,6 +136,7 @@
 
 	lua_rawgeti(L, LUA_REGISTRYINDEX, timer->cb_ref);
 	luaL_unref(L, LUA_REGISTRYINDEX, timer->cb_ref);
+	timer->cb_ref = LUA_NOREF;
 
 	err = lua_pcall(L, 0, 0, 0);
 	if (err) {
@@ -276,6 +277,10 @@
 
 	luaL_argcheck(L, lua_isuserdata(L, -1), 1, "No userdata");
 	timer = lua_touserdata(L, -1);
+	if (timer->cb_ref != LUA_NOREF) {
+		luaL_unref(L, LUA_REGISTRYINDEX, timer->cb_ref);
+		timer->cb_ref = LUA_NOREF;
+	}
 
 	prim = mobile_prim_alloc(PRIM_MOB_TIMER_CANCEL, PRIM_OP_REQUEST);
 	prim->u.timer.timer_id = (intptr_t) timer;

-- 
To view, visit https://gerrit.osmocom.org/10536
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4e8db297e816d3d07a46147d5d3bdc0e8fae6c9a
Gerrit-Change-Number: 10536
Gerrit-PatchSet: 2
Gerrit-Owner: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180824/5fc6d5c8/attachment.htm>


More information about the gerrit-log mailing list