mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-23 20:05:11 +00:00
code: Reorder and fix static initializers
These most likely require dependencies to be migrated to the new system.
This commit is contained in:
parent
d51847152c
commit
7d1dc4792a
1 changed files with 20 additions and 25 deletions
|
@ -18,7 +18,6 @@
|
|||
|
||||
#ifdef ENABLE_UPDATER
|
||||
#include "updater.hpp"
|
||||
//static std::shared_ptr<streamfx::updater> _updater;
|
||||
#endif
|
||||
|
||||
#include "warning-disable.hpp"
|
||||
|
@ -71,19 +70,6 @@ MODULE_EXPORT bool obs_module_load(void)
|
|||
try {
|
||||
DLOG_INFO("Loading Version %s", STREAMFX_VERSION_STRING);
|
||||
|
||||
// Run all initializers.
|
||||
for (auto kv : streamfx::get_initializers()) {
|
||||
for (auto init : kv.second) {
|
||||
try {
|
||||
init();
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Initializer threw exception: %s", ex.what());
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Initializer threw unknown exception.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize GLAD (OpenGL)
|
||||
{
|
||||
streamfx::obs::gs::context gctx{};
|
||||
|
@ -102,6 +88,19 @@ MODULE_EXPORT bool obs_module_load(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
// Run all initializers.
|
||||
for (auto kv : streamfx::get_initializers()) {
|
||||
for (auto init : kv.second) {
|
||||
try {
|
||||
init();
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Initializer threw exception: %s", ex.what());
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Initializer threw unknown exception.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DLOG_INFO("Loaded Version %s", STREAMFX_VERSION_STRING);
|
||||
return true;
|
||||
} catch (std::exception const& ex) {
|
||||
|
@ -118,17 +117,6 @@ MODULE_EXPORT void obs_module_unload(void)
|
|||
try {
|
||||
DLOG_INFO("Unloading Version %s", STREAMFX_VERSION_STRING);
|
||||
|
||||
// Finalize GLAD (OpenGL)
|
||||
{
|
||||
streamfx::obs::gs::context gctx{};
|
||||
_streamfx_gfx_opengl.reset();
|
||||
}
|
||||
|
||||
// // Auto-Updater
|
||||
//#ifdef ENABLE_UPDATER
|
||||
// _updater.reset();
|
||||
//#endif
|
||||
|
||||
// Run all finalizers.
|
||||
for (auto kv : streamfx::get_finalizers()) {
|
||||
for (auto init : kv.second) {
|
||||
|
@ -142,6 +130,13 @@ MODULE_EXPORT void obs_module_unload(void)
|
|||
}
|
||||
}
|
||||
|
||||
// Finalize GLAD (OpenGL)
|
||||
{
|
||||
streamfx::obs::gs::context gctx{};
|
||||
_streamfx_gfx_opengl.reset();
|
||||
}
|
||||
|
||||
|
||||
DLOG_INFO("Unloaded Version %s", STREAMFX_VERSION_STRING);
|
||||
} catch (std::exception const& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s", __FUNCTION_NAME__, ex.what());
|
||||
|
|
Loading…
Reference in a new issue