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
+7 -3
View File
@@ -1120,7 +1120,8 @@ void NodeView::open_selected_node_in_viewer()
// Find first viewer in list of selected nodes and open it
foreach (Node *n, selected_nodes_) {
if (ViewerOutput *viewer = dynamic_cast<ViewerOutput *>(n)) {
Core::instance()->open_node_in_viewer(viewer);
Core::instance()->open_node_in_viewer(
reinterpret_cast<OakEngineNode *>(viewer));
break;
}
}
@@ -1734,7 +1735,9 @@ void NodeView::group_nodes()
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(group), reinterpret_cast<void *>(context), avg_pos.x(), avg_pos.y(), 0));
// Do command
Core::instance()->label_nodes({ group }, command);
Core::instance()->label_nodes(
QVector<OakEngineNode *>{ reinterpret_cast<OakEngineNode *>(group) },
command);
oakengine_undo_push(command, tr("Grouped Nodes").toUtf8().constData());
}
@@ -1877,7 +1880,8 @@ void NodeView::show_selected_node_in_param_editor()
void NodeView::label_selected_nodes()
{
Core::instance()->label_nodes(selected_nodes_);
Core::instance()->label_nodes(
reinterpret_cast<const QVector<OakEngineNode *> &>(selected_nodes_));
}
void NodeView::item_about_to_be_deleted(NodeViewItem *item)
@@ -537,7 +537,8 @@ void ProjectExplorer::show_item_properties_dialog()
fpd.exec();
} else if (dynamic_cast<Folder *>(sel)) {
Core::instance()->label_nodes(context_menu_items_);
Core::instance()->label_nodes(
reinterpret_cast<const QVector<OakEngineNode *> &>(context_menu_items_));
} else if (dynamic_cast<Sequence *>(sel)) {
SequenceDialog sd(static_cast<Sequence *>(sel),
@@ -463,7 +463,7 @@ bool ProjectViewModel::dropMimeData(const QMimeData *data,
}
// Trigger an import
Core::instance()->import_files(urls, static_cast<Folder *>(drop_item));
Core::instance()->import_files(urls, reinterpret_cast<OakEngineNode *>(drop_item));
return true;
}
+4 -2
View File
@@ -1737,8 +1737,10 @@ void TimelineWidget::nest_selected_clips()
// Create new sequence
Project *project = this->get_connected_node()->project();
Sequence *nest =
Core::instance()->create_new_sequence_for_project(tr("Nested Sequence %1"), project);
Sequence *nest = reinterpret_cast<Sequence *>(
Core::instance()->create_new_sequence_for_project(
tr("Nested Sequence %1"),
reinterpret_cast<OakEngineProject *>(project)));
{
oak_video_params vpod;
oakengine_viewer_get_video_params(
+4 -4
View File
@@ -409,12 +409,12 @@ void ImportTool::drop_ghosts(bool insert, void *parent_command)
}
if (behavior != k_dws_disable) {
Project *active_project = Core::instance()->get_active_project();
OakEngineProject *active_project = Core::instance()->get_active_project();
if (active_project) {
Sequence *new_sequence =
Sequence *new_sequence = reinterpret_cast<Sequence *>(
Core::instance()->create_new_sequence_for_project(
active_project);
active_project));
oakengine_viewer_set_default_parameters(
reinterpret_cast<OakEngineNode *>(new_sequence));
@@ -453,7 +453,7 @@ void ImportTool::drop_ghosts(bool insert, void *parent_command)
}
if (sequence_is_valid) {
dst_graph = Core::instance()->get_active_project();
dst_graph = reinterpret_cast<Project *>(Core::instance()->get_active_project());
oakengine_undo_command_multi_add_child(command,
oakengine_node_add_to_project_command(
+2 -1
View File
@@ -854,7 +854,8 @@ void ViewerWidget::request_next_dry_run()
void ViewerWidget::save_frame_as_image()
{
Core::instance()->open_export_dialog_for_viewer(get_connected_node(), true);
Core::instance()->open_export_dialog_for_viewer(
reinterpret_cast<OakEngineNode *>(get_connected_node()), true);
}
void ViewerWidget::detect_multicam_node_now()