mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 14:31:50 +00:00
fixes
This commit is contained in:
parent
5b82b18c6f
commit
7415726e47
3 changed files with 4 additions and 0 deletions
|
|
@ -43,6 +43,7 @@ public:
|
||||||
observers.emplace(id, callback);
|
observers.emplace(id, callback);
|
||||||
return std::shared_ptr<int>(new int(id), [this](int* id) {
|
return std::shared_ptr<int>(new int(id), [this](int* id) {
|
||||||
observers.erase(*id);
|
observers.erase(*id);
|
||||||
|
delete id;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ scriptenv scripting::create_pack_environment(const ContentPack& pack) {
|
||||||
state->pop();
|
state->pop();
|
||||||
return std::shared_ptr<int>(new int(id), [=](int* id) {
|
return std::shared_ptr<int>(new int(id), [=](int* id) {
|
||||||
state->removeEnvironment(*id);
|
state->removeEnvironment(*id);
|
||||||
|
delete id;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,6 +91,7 @@ scriptenv scripting::create_doc_environment(scriptenv parent, const std::string&
|
||||||
state->pop();
|
state->pop();
|
||||||
return std::shared_ptr<int>(new int(id), [=](int* id) {
|
return std::shared_ptr<int>(new int(id), [=](int* id) {
|
||||||
state->removeEnvironment(*id);
|
state->removeEnvironment(*id);
|
||||||
|
delete id;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
|
/// @brief Keeps shared pointers alive until destruction
|
||||||
class ObjectsKeeper {
|
class ObjectsKeeper {
|
||||||
std::vector<std::shared_ptr<void>> ptrs;
|
std::vector<std::shared_ptr<void>> ptrs;
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue