[vlc-commits] [Git][videolan/vlc][master] lua/extension: close the Lua state on deactivation
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Thu Nov 19 10:33:29 UTC 2026
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
3adc195a by BipulLamsal at 2026-11-19T10:32:50+01:00
lua/extension: close the Lua state on deactivation
When deactivated, extensions should not keep any more data and should
be ready to restart with a clean state. The current code was keeping
the state alive as it was reused between multiple activate/deactivate
cycles.
One symptom of this recycling is that the extension IO are terminated
when the extension is disabled by using vlc_interrupt mechanism, and
the same interruption state was also recycled despite already being
killed, leading to the IO being terminated immediately as soon as the
extensions are opened a second time.
A different mechanism should be in place to separate extension
disabling from closing the window opened from the extension, when
needed.
Close it after the deactivate is executed so GetLuaState() builds a
fresh state and interrupt context.
- - - - -
1 changed file:
- modules/lua/extension.c
Changes:
=====================================
modules/lua/extension.c
=====================================
@@ -580,8 +580,6 @@ int lua_ExtensionDeactivate( extensions_manager_t *p_mgr, extension_t *p_ext )
assert( p_mgr != NULL && p_ext != NULL );
struct lua_extension *sys = p_ext->p_sys;
- vlclua_fd_interrupt(&sys->dtable);
-
// Unset and release input objects
if (sys->p_item)
{
@@ -589,7 +587,19 @@ int lua_ExtensionDeactivate( extensions_manager_t *p_mgr, extension_t *p_ext )
sys->p_item = NULL;
}
- return lua_ExecuteFunction( p_mgr, p_ext, "deactivate", LUA_END );
+ if (sys->L == NULL)
+ return VLC_SUCCESS;
+
+ vlclua_fd_interrupt(&sys->dtable);
+
+ int i_ret = lua_ExecuteFunction( p_mgr, p_ext, "deactivate", LUA_END );
+
+ /* Clear Lua State */
+ lua_close(sys->L);
+ vlclua_fd_cleanup(&sys->dtable);
+ sys->L = NULL;
+
+ return i_ret;
}
int lua_ExtensionWidgetClick( extensions_manager_t *p_mgr,
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3adc195a6f2b649a5409fb551bf9f144eea5b33d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3adc195a6f2b649a5409fb551bf9f144eea5b33d
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list