Skip to content

Commit 849db6d

Browse files
edrioukCopilot
andauthored
RPC: Clear RTE Projects on ConvertSolution and LoadSolution (#2486)
## Fixes <!-- List the issue(s) this PR resolves --> - Current implementation creates new RTE projects for each ConvertSolution and LoadSolution and does not dispose them until termination. ## Changes <!-- List the changes this PR introduces --> - Clear RTE Projects on ConvertSolution and LoadSolution RPC calls ## Checklist <!-- Put an `x` in the boxes. All tasks must be completed and boxes checked before merging. --> - [ ] 🤖 This change is covered by unit tests (if applicable). - [ ] 🤹 Manual testing has been performed (if necessary). - [ ] 🛡️ Security impacts have been considered (if relevant). - [ ] 📖 Documentation updates are complete (if required). - [ ] 🧠 Third-party dependencies and TPIP updated (if required). --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent bbc48bf commit 849db6d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tools/projmgr/src/ProjMgrRpcServer.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ RpcArgs::SuccessResult RpcHandler::LoadPacks(void) {
304304
RpcArgs::SuccessResult result = {false};
305305
m_manager.Clear();
306306
m_solutionLoaded = false;
307+
// clear project and global RTE data, packs stay loaded
307308
ProjMgrKernel::Get()->GetGlobalModel()->Clear();
308309
m_worker.InitializeModel();
309310
m_worker.SetLoadPacksPolicy(LoadPacksPolicy::ALL);
@@ -317,7 +318,10 @@ RpcArgs::SuccessResult RpcHandler::LoadPacks(void) {
317318

318319
RpcArgs::SuccessResult RpcHandler::LoadSolution(const string& solution, const string& activeTarget) {
319320
m_bUseAllPacks = false; // loading solution will first use only listed packs
320-
m_packReferences.clear();
321+
m_packReferences.clear(); // will be updated
322+
m_solutionLoaded = false; // assume not loaded yet
323+
// clear only projects, global RTE data and packs stay loaded
324+
ProjMgrKernel::Get()->GetGlobalModel()->ClearProjects();
321325
RpcArgs::SuccessResult result = {false};
322326
const auto csolutionFile = RteFsUtils::MakePathCanonical(solution);
323327
if(!regex_match(csolutionFile, regex(".*\\.csolution\\.(yml|yaml)"))) {
@@ -857,6 +861,9 @@ RpcArgs::ConvertSolutionResult RpcHandler::ConvertSolution(const string& solutio
857861
}
858862
m_bUseAllPacks = false; // loading solution will first use only listed packs
859863
m_packReferences.clear(); // will be updated
864+
m_solutionLoaded = false; // assume not loaded
865+
// clear only projects, RTE data and packs stay loaded
866+
ProjMgrKernel::Get()->GetGlobalModel()->ClearProjects();
860867

861868
if(!m_manager.RunConvert(csolutionFile, activeTarget, updateRte) || !ProjMgrLogger::Get().GetErrors().empty()) {
862869
if(m_worker.HasVarDefineError()) {

0 commit comments

Comments
 (0)