fix: PVS-Studio V508 mark false

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
Vyacheslav Ivanov 2024-08-03 21:05:19 +03:00 committed by Pugemon
parent 7c8f04aa75
commit 4efa574eec
No known key found for this signature in database
GPG Key ID: 472FA343B3CC3287
4 changed files with 6 additions and 6 deletions

View File

@ -48,7 +48,7 @@ public:
if (callOnStart) {
callback(value);
}
return std::shared_ptr<int>(new int(id), [this](int* id) {
return std::shared_ptr<int>(new int(id), [this](int* id) { //-V508
observers.erase(*id);
delete id;
});

View File

@ -95,7 +95,7 @@ glshader compile_shader(GLenum type, const GLchar* source, const std::string& fi
"vertex shader compilation failed ("+file+"):\n"+std::string(infoLog)
);
}
return glshader(new GLuint(shader), shader_deleter);
return glshader(new GLuint(shader), shader_deleter); //-V508
}
std::unique_ptr<Shader> Shader::create(

View File

@ -74,7 +74,7 @@ void scripting::initialize(Engine* engine) {
lua::pushstring(L, pack.id);
lua::setfield(L, "PACK_ID");
lua::pop(L);
return std::shared_ptr<int>(new int(id), [=](int* id) {
return std::shared_ptr<int>(new int(id), [=](int* id) { //-V508
lua::removeEnvironment(L, *id);
delete id;
});
@ -101,7 +101,7 @@ void scripting::initialize(Engine* engine) {
lua::pop(L);
}
lua::pop(L);
return std::shared_ptr<int>(new int(id), [=](int* id) {
return std::shared_ptr<int>(new int(id), [=](int* id) { //-V508
lua::removeEnvironment(L, *id);
delete id;
});
@ -131,7 +131,7 @@ void scripting::initialize(Engine* engine) {
}
lua::pop(L);
return std::shared_ptr<int>(new int(id), [=](int* id) {
return std::shared_ptr<int>(new int(id), [=](int* id) { //-V508
lua::removeEnvironment(L, *id);
delete id;
});

View File

@ -16,7 +16,7 @@ namespace util {
observer_handler add(runnable callback) {
int id = nextid++;
runnables[id] = std::move(callback);
return observer_handler(new int(id), [this](int* id) {
return observer_handler(new int(id), [this](int* id) { //-V508
runnables.erase(*id);
delete id;
});