Feature/globals handling (#1352)

* Cleaner handling of global state
* Prevent Lua memory corruption (closes #982)
* Initialize glfw first thing to prevent weird joystick loading bug during startup
This commit is contained in:
Alexander Bock
2020-10-21 22:30:05 +02:00
committed by GitHub
parent 1525a0490d
commit efffc25ce0
164 changed files with 1484 additions and 1390 deletions
+8 -8
View File
@@ -27,8 +27,8 @@ namespace openspace::luascriptfunctions {
int connect(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::connect");
if (global::windowDelegate.isMaster()) {
global::parallelPeer.connect();
if (global::windowDelegate->isMaster()) {
global::parallelPeer->connect();
}
ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack");
@@ -38,8 +38,8 @@ int connect(lua_State* L) {
int disconnect(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::disconnect");
if (global::windowDelegate.isMaster()) {
global::parallelPeer.connect();
if (global::windowDelegate->isMaster()) {
global::parallelPeer->connect();
}
ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack");
@@ -49,8 +49,8 @@ int disconnect(lua_State* L) {
int requestHostship(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::requestHostship");
if (global::windowDelegate.isMaster()) {
global::parallelPeer.requestHostship();
if (global::windowDelegate->isMaster()) {
global::parallelPeer->requestHostship();
}
ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack");
@@ -60,8 +60,8 @@ int requestHostship(lua_State* L) {
int resignHostship(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::resignHostship");
if (global::windowDelegate.isMaster()) {
global::parallelPeer.resignHostship();
if (global::windowDelegate->isMaster()) {
global::parallelPeer->resignHostship();
}
ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack");