diff --git a/src/runtime2/component/component.rs b/src/runtime2/component/component.rs index 962841d303fbecfe98385fc1f3479cf172042d11..b0dcb7df048c83f40ec96f54b1d9ab7b7e817eb9 100644 --- a/src/runtime2/component/component.rs +++ b/src/runtime2/component/component.rs @@ -908,8 +908,8 @@ pub(crate) fn special_create_component( // Transfer messages and link instantiator to created component for pair in port_pairs.iter() { instantiator_ctx.change_port_peer(sched_ctx, pair.instantiator_handle, None); - instantiator_ctx.remove_port(pair.instantiator_handle); transfer_messages(inbox_main, inbox_backup, pair, instantiator_ctx, created_ctx, created_component.as_mut()); + instantiator_ctx.remove_port(pair.instantiator_handle); let created_port_info = created_ctx.get_port(pair.created_handle); if pair.is_open && created_port_info.peer_comp_id == instantiator_ctx.id { @@ -1075,8 +1075,8 @@ pub(crate) fn perform_create_component( // Transferring the messages and removing the port from the // instantiator component instantiator_ctx.change_port_peer(sched_ctx, pair.instantiator_handle, None); - instantiator_ctx.remove_port(pair.instantiator_handle); transfer_messages(inbox_main, inbox_backup, pair, instantiator_ctx, created_ctx, created_component.as_mut()); + instantiator_ctx.remove_port(pair.instantiator_handle); // Here we take care of the case where the instantiator previously owned // both ends of the channel, but has transferred one port to the new