change: remove UB in core.h

This commit is contained in:
2026-07-27 08:26:13 +08:00
parent a84e75ef47
commit 17888a2dc1
13 changed files with 815 additions and 141 deletions
+9
View File
@@ -445,6 +445,15 @@ oakengine_project_add_node(OakEngineProject *project, const char *type_id);
OAKENGINE_API int oakengine_project_remove_node(OakEngineProject *project,
OakEngineNode *node);
/**
* @brief Schedule a node for deferred deletion (QObject::deleteLater).
*
* Use this to dispose of orphaned nodes that were created but never added
* to a project (e.g. a sequence whose creation dialog was cancelled).
* The handle becomes invalid after the next event-loop iteration.
*/
OAKENGINE_API void oakengine_node_delete_later(OakEngineNode *node);
/**
* @brief Connect `output_node`'s output into `input_node`'s `input_id`
* (undoable, olive::NodeEdgeAddCommand).
+7
View File
@@ -1286,6 +1286,13 @@ int oakengine_project_remove_node(OakEngineProject *project,
return OAKENGINE_OK;
}
void oakengine_node_delete_later(OakEngineNode *node)
{
if (olive::Node *n = impl(node)) {
n->deleteLater();
}
}
int oakengine_node_connect(OakEngineNode *output_node,
OakEngineNode *input_node, const char *input_id)
{
+35
View File
@@ -0,0 +1,35 @@
/***
Oak - Non-Linear Video Editor
Copyright (C) 2026 Oak Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
// Shared entry point for the liboakengine facade GTest binaries.
//
// Unlike the Qt-based olive-gtest harness, these facade tests manage their own
// oakengine_init()/oakengine_shutdown() lifecycle inside each TEST (their init
// flags differ -- headless vs. render vs. lifecycle probing -- so a single
// shared fixture is not possible). This main therefore only bootstraps Google
// Test; no global engine state is created here.
#include <gtest/gtest.h>
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}