CLuaInstance: The first call to Lua::PlayFile() block restoreNeutrino

- Running restoreNeutrino when exiting the plugin and
   function is blocked
 - Set Lua api version to 1.18
This commit is contained in:
M. Liebmann
2015-12-08 06:15:56 +01:00
parent 558fea4ec4
commit ffea6559c9
3 changed files with 26 additions and 1 deletions

View File

@@ -67,6 +67,14 @@ int CLuaInstance::PlayFile(lua_State *L)
return 0;
}
CLuaData *W = CheckData(L, 1);
if (!W)
return 0;
if (W->moviePlayerBlocked == false) {
CMoviePlayerGui::getInstance().setBlockedFromPlugin(true);
W->moviePlayerBlocked = true;
}
const char *title;
const char *info1 = "";
const char *info2 = "";

View File

@@ -512,6 +512,11 @@ void CLuaInstance::runScript(const char *fileName, std::vector<std::string> *arg
DisplayErrorMessage(lua_tostring(lua, -1), "Lua Script Error:");
if (error_string)
*error_string = std::string(lua_tostring(lua, -1));
/* restoreNeutrino at plugin crash, when blocked from plugin */
if (CMoviePlayerGui::getInstance().getBlockedFromPlugin()) {
CMoviePlayerGui::getInstance().setBlockedFromPlugin(false);
CMoviePlayerGui::getInstance().restoreNeutrino();
}
}
}
@@ -660,6 +665,7 @@ int CLuaInstance::NewWindow(lua_State *L)
CFBWindow *W = new CFBWindow(x, y, w, h);
D->fbwin = W;
D->rcinput = g_RCInput;
D->moviePlayerBlocked = false;
lua_boxpointer(L, D);
luaL_getmetatable(L, className);
lua_setmetatable(L, -2);
@@ -1156,6 +1162,16 @@ int CLuaInstance::GCWindow(lua_State *L)
}
CNeutrinoFonts::getInstance()->deleteDynFontExtAll();
/* restoreNeutrino at plugin closing, when blocked from plugin */
if (w->moviePlayerBlocked &&
CMoviePlayerGui::getInstance().getBlockedFromPlugin() &&
CMoviePlayerGui::getInstance().Playing()) {
// printf(">>>>[%s:%d] (restoreNeutrino()) moviePlayerBlocked: %d\n", __func__, __LINE__, w->moviePlayerBlocked);
CMoviePlayerGui::getInstance().setBlockedFromPlugin(false);
w->moviePlayerBlocked = false;
CMoviePlayerGui::getInstance().restoreNeutrino();
}
delete w->fbwin;
w->rcinput = NULL;
delete w;

View File

@@ -34,7 +34,7 @@ extern "C" {
#include <vector>
#define LUA_API_VERSION_MAJOR 1
#define LUA_API_VERSION_MINOR 17
#define LUA_API_VERSION_MINOR 18
typedef std::pair<lua_Integer, Font*> fontmap_pair_t;
typedef std::map<lua_Integer, Font*> fontmap_t;
@@ -51,6 +51,7 @@ struct CLuaData
CRCInput *rcinput;
fontmap_t fontmap;
screenmap_t screenmap;
bool moviePlayerBlocked;
};
struct CLuaMenuItem