Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
7478dfe4
Commit
7478dfe4
authored
Feb 26, 2010
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not store extension pointer in a variable visible from the lua code.
parent
2c244563
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
modules/misc/lua/extension.c
modules/misc/lua/extension.c
+17
-9
modules/misc/lua/extension.h
modules/misc/lua/extension.h
+1
-0
No files found.
modules/misc/lua/extension.c
View file @
7478dfe4
...
...
@@ -720,14 +720,12 @@ static lua_State* GetLuaState( extensions_manager_t *p_mgr,
return
NULL
;
}
vlclua_set_this
(
L
,
p_mgr
);
vlclua_extension_set
(
L
,
p_ext
);
luaL_openlibs
(
L
);
luaL_register
(
L
,
"vlc"
,
p_reg
);
luaopen_msg
(
L
);
lua_pushlightuserdata
(
L
,
p_ext
);
lua_setfield
(
L
,
-
2
,
"extension"
);
if
(
p_ext
)
{
/* Load more libraries */
...
...
@@ -916,17 +914,27 @@ static int TriggerExtension( extensions_manager_t *p_mgr,
return
i_ret
;
}
/** Set extension associated to the current script
* @param L current lua_State
* @param p_ext the extension
*/
void
vlclua_extension_set
(
lua_State
*
L
,
extension_t
*
p_ext
)
{
lua_pushlightuserdata
(
L
,
vlclua_extension_set
);
lua_pushlightuserdata
(
L
,
p_ext
);
lua_rawset
(
L
,
LUA_REGISTRYINDEX
);
}
/** Retrieve extension associated to the current script
* @param L current lua_State
* @return
Lua userdata "vlc.extension"
* @return
Extension pointer
**/
extension_t
*
vlclua_extension_get
(
lua_State
*
L
)
{
extension_t
*
p_ext
=
NULL
;
lua_getglobal
(
L
,
"vlc"
);
lua_getfield
(
L
,
-
1
,
"extension"
);
p_ext
=
(
extension_t
*
)
lua_topointer
(
L
,
lua_gettop
(
L
)
);
lua_pop
(
L
,
2
);
lua_pushlightuserdata
(
L
,
vlclua_extension_set
);
lua_rawget
(
L
,
LUA_REGISTRYINDEX
);
extension_t
*
p_ext
=
(
extension_t
*
)
lua_topointer
(
L
,
-
1
);
lua_pop
(
L
,
1
);
return
p_ext
;
}
...
...
modules/misc/lua/extension.h
View file @
7478dfe4
...
...
@@ -117,6 +117,7 @@ bool LockExtension( extension_t *p_ext );
void
UnlockExtension
(
extension_t
*
p_ext
);
/* Lua specific functions */
void
vlclua_extension_set
(
lua_State
*
L
,
extension_t
*
);
extension_t
*
vlclua_extension_get
(
lua_State
*
L
);
int
lua_ExtensionActivate
(
extensions_manager_t
*
,
extension_t
*
);
int
lua_ExtensionDeactivate
(
extensions_manager_t
*
,
extension_t
*
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment