<p>Holger Freyther has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/10536">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Forget about the callback after use and cancellation<br><br>Don't try to unref something else after we have given up our<br>spot in the table.<br><br>Change-Id: I4e8db297e816d3d07a46147d5d3bdc0e8fae6c9a<br>---<br>M src/host/layer23/src/mobile/script_lua.c<br>1 file changed, 5 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/36/10536/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/host/layer23/src/mobile/script_lua.c b/src/host/layer23/src/mobile/script_lua.c</span><br><span>index 4cfe55a..088aab3 100644</span><br><span>--- a/src/host/layer23/src/mobile/script_lua.c</span><br><span>+++ b/src/host/layer23/src/mobile/script_lua.c</span><br><span>@@ -136,6 +136,7 @@</span><br><span> </span><br><span>        lua_rawgeti(L, LUA_REGISTRYINDEX, timer->cb_ref);</span><br><span>         luaL_unref(L, LUA_REGISTRYINDEX, timer->cb_ref);</span><br><span style="color: hsl(120, 100%, 40%);">+   timer->cb_ref = LUA_NOREF;</span><br><span> </span><br><span>    err = lua_pcall(L, 0, 0, 0);</span><br><span>         if (err) {</span><br><span>@@ -276,6 +277,10 @@</span><br><span> </span><br><span>        luaL_argcheck(L, lua_isuserdata(L, -1), 1, "No userdata");</span><br><span>         timer = lua_touserdata(L, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+        if (timer->cb_ref != LUA_NOREF) {</span><br><span style="color: hsl(120, 100%, 40%);">+          luaL_unref(L, LUA_REGISTRYINDEX, timer->cb_ref);</span><br><span style="color: hsl(120, 100%, 40%);">+           timer->cb_ref = LUA_NOREF;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span>        prim = mobile_prim_alloc(PRIM_MOB_TIMER_CANCEL, PRIM_OP_REQUEST);</span><br><span>    prim->u.timer.timer_id = (intptr_t) timer;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10536">change 10536</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/10536"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmocom-bb </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I4e8db297e816d3d07a46147d5d3bdc0e8fae6c9a </div>
<div style="display:none"> Gerrit-Change-Number: 10536 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Holger Freyther <holger@freyther.de> </div>