Update Ghoul repository

Adjust OnExit to use defer instead
This commit is contained in:
Alexander Bock
2018-02-14 17:16:54 -05:00
parent b77b54e0f6
commit 9848eea5ac
7 changed files with 18 additions and 27 deletions
@@ -39,9 +39,8 @@
#include <openspace/scene/scenegraphnode.h>
#include <openspace/scripting/scriptengine.h>
#include <ghoul/misc/onscopeexit.h>
#include <ghoul/lua/ghoul_lua.h>
#include <ghoul/misc/defer.h>
#include <fmt/format.h>
@@ -70,8 +69,7 @@ void GuiGlobeBrowsingComponent::render() {
ImGui::Begin("Globe Browsing", &e, WindowSize, 0.5f);
_isEnabled = e;
_isCollapsed = ImGui::IsWindowCollapsed();
OnExit([]() {ImGui::End(); }); // We escape early from this function in a few places
defer { ImGui::End(); };
// Render the list of planets
std::vector<SceneGraphNode*> nodes =
+8 -15
View File
@@ -72,7 +72,6 @@
#include <ghoul/ghoul.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <ghoul/misc/onscopeexit.h>
#include <ghoul/cmdparser/commandlineparser.h>
#include <ghoul/cmdparser/singlecommand.h>
#include <ghoul/filesystem/filesystem.h>
@@ -80,6 +79,7 @@
#include <ghoul/font/fontrenderer.h>
#include <ghoul/logging/consolelog.h>
#include <ghoul/logging/visualstudiooutputlog.h>
#include <ghoul/misc/defer.h>
#include <ghoul/opengl/debugcontext.h>
#include <ghoul/systemcapabilities/systemcapabilities>
@@ -636,12 +636,10 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
windowWrapper().setBarrier(false);
windowWrapper().setSynchronization(false);
OnExit(
[this]() {
windowWrapper().setSynchronization(true);
windowWrapper().setBarrier(true);
}
);
defer {
windowWrapper().setSynchronization(true);
windowWrapper().setBarrier(true);
};
if (assetPath == "") {
return;
@@ -1352,10 +1350,6 @@ void OpenSpaceEngine::render(const glm::mat4& sceneMatrix,
);
}
OnExit([] {
LTRACE("OpenSpaceEngine::render(end)");
});
const bool isGuiWindow =
_windowWrapper->hasGuiWindow() ? _windowWrapper->isGuiWindow() : true;
if (isGuiWindow) {
@@ -1368,14 +1362,11 @@ void OpenSpaceEngine::render(const glm::mat4& sceneMatrix,
func();
}
LTRACE("OpenSpaceEngine::render(end)");
}
void OpenSpaceEngine::drawOverlays() {
LTRACE("OpenSpaceEngine::drawOverlays(begin)");
OnExit([] {
LTRACE("OpenSpaceEngine::drawOverlays(end)");
});
std::unique_ptr<performance::PerformanceMeasurement> perf;
if (OsEng.renderEngine().performanceManager()) {
@@ -1408,6 +1399,8 @@ void OpenSpaceEngine::drawOverlays() {
for (const auto& func : _moduleCallbacks.draw2D) {
func();
}
LTRACE("OpenSpaceEngine::drawOverlays(end)");
}
void OpenSpaceEngine::postDraw() {
+4 -2
View File
@@ -28,8 +28,8 @@
#include <openspace/performance/performancelayout.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/defer.h>
#include <ghoul/misc/sharedmemory.h>
#include <ghoul/misc/onscopeexit.h>
#include <ghoul/filesystem/filesystem.h>
#include <algorithm>
@@ -142,7 +142,9 @@ PerformanceManager::PerformanceManager(std::string loggingDirectory, std::string
ghoul::SharedMemory sharedMemory(GlobalSharedMemoryName);
sharedMemory.acquireLock();
OnExit([&](){sharedMemory.releaseLock();});
defer {
sharedMemory.releaseLock();
};
GlobalMemory* m = reinterpret_cast<GlobalMemory*>(sharedMemory.memory());
+3 -3
View File
@@ -31,7 +31,7 @@
#include <ghoul/lua/luastate.h>
#include <ghoul/lua/lua_helper.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/onscopeexit.h>
#include <ghoul/misc/defer.h>
#include <ghoul/filesystem/filesystem.h>
#include <fmt/format.h>
@@ -250,9 +250,9 @@ bool AssetLoader::loadAsset(std::shared_ptr<Asset> asset) {
std::shared_ptr<Asset> parentAsset = _currentAsset;
setCurrentAsset(asset);
ghoul::OnScopeExit e([this, parentAsset] {
defer {
setCurrentAsset(parentAsset);
});
};
if (!FileSys.fileExists(asset->assetFilePath())) {
LERROR("Could not load asset '" << asset->assetFilePath() <<
-1
View File
@@ -45,7 +45,6 @@
#include <ghoul/lua/ghoul_lua.h>
#include <ghoul/lua/lua_helper.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/misc/onscopeexit.h>
#include <ghoul/misc/threadpool.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
-1
View File
@@ -27,7 +27,6 @@
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/lua/lua_helper.h>
#include <ghoul/misc/onscopeexit.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/scripting/scriptengine.h>