[PR #1161] [MERGED] Convert CommandHistory to a std::shared_ptr #24507

Open
opened 2026-01-31 09:03:42 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/1161
Author: @ChristophePichaud
Created: 6/7/2019
Status: Merged
Merged: 6/19/2019
Merged by: @adiviness

Base: dev/austdi/NewCookedReadHead: dev/austdi/NewCookedRead


📝 Commits (5)

  • 1452071 Changes for Issue #1058 are done in VS2017. Works fine.
  • 4e4b965 calculatePopupSize use a const CommandHistory& and is called from a shared_ptr.
  • 3f19be4 Some shared_ptr are converted into refrences.
  • 3cd6f1b Add missing const stuff.
  • e8104ed cookedReadData.History() returns a ref. Callers adapted. OK.

📊 Changes

9 files changed (+46 additions, -46 deletions)

View changed files

📝 src/host/cookedRead.cpp (+1 -1)
📝 src/host/cookedRead.hpp (+2 -2)
📝 src/host/history.cpp (+33 -33)
📝 src/host/history.h (+4 -4)
📝 src/host/stream.cpp (+1 -1)
📝 src/host/ut_host/CommandLineTests.cpp (+2 -2)
📝 src/host/ut_host/CommandListPopupTests.cpp (+1 -1)
📝 src/host/ut_host/CommandNumberPopupTests.cpp (+1 -1)
📝 src/host/ut_host/CopyToCharPopupTests.cpp (+1 -1)

📄 Description

Summary of the Pull Request

CommandHistory becomes a std::shared_ptr. Minor changes in code and unit tests.
Some ctor has been modified.
There is not weak_ptr usage or raw pointer. Every times a shared_ptr is passed, its using the ref counter of the = operator. It prevents unexpected behaviour and hangs.

References

My previous PR 1148 was bad quality. you can cancel it.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Previous commit was a mistake, it involves modifcations and both the migration to vs2019 and platform toolset v142.
The new PR is juts handling H/CPP modifications.
Worked in VS2017 OK.

Validation Steps Performed

Manuel test of running tab and ask for cmd and type command, and ask for history...


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/1161 **Author:** [@ChristophePichaud](https://github.com/ChristophePichaud) **Created:** 6/7/2019 **Status:** ✅ Merged **Merged:** 6/19/2019 **Merged by:** [@adiviness](https://github.com/adiviness) **Base:** `dev/austdi/NewCookedRead` ← **Head:** `dev/austdi/NewCookedRead` --- ### 📝 Commits (5) - [`1452071`](https://github.com/microsoft/terminal/commit/14520719a1f9c0d05544e2655d2b21374d34bb9a) Changes for Issue #1058 are done in VS2017. Works fine. - [`4e4b965`](https://github.com/microsoft/terminal/commit/4e4b965246c0467b52bcd8ae4a6f5b7036761057) calculatePopupSize use a const CommandHistory& and is called from a shared_ptr. - [`3f19be4`](https://github.com/microsoft/terminal/commit/3f19be4ea2cb1a3fdf77d6f691f9e96b95554008) Some shared_ptr are converted into refrences. - [`3cd6f1b`](https://github.com/microsoft/terminal/commit/3cd6f1b55439edd538bfb0921dae4b17c1842d71) Add missing const stuff. - [`e8104ed`](https://github.com/microsoft/terminal/commit/e8104ed1943123ab2f52e90f62f4f6f053f644b9) cookedReadData.History() returns a ref. Callers adapted. OK. ### 📊 Changes **9 files changed** (+46 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `src/host/cookedRead.cpp` (+1 -1) 📝 `src/host/cookedRead.hpp` (+2 -2) 📝 `src/host/history.cpp` (+33 -33) 📝 `src/host/history.h` (+4 -4) 📝 `src/host/stream.cpp` (+1 -1) 📝 `src/host/ut_host/CommandLineTests.cpp` (+2 -2) 📝 `src/host/ut_host/CommandListPopupTests.cpp` (+1 -1) 📝 `src/host/ut_host/CommandNumberPopupTests.cpp` (+1 -1) 📝 `src/host/ut_host/CopyToCharPopupTests.cpp` (+1 -1) </details> ### 📄 Description ## Summary of the Pull Request CommandHistory becomes a std::shared_ptr. Minor changes in code and unit tests. Some ctor has been modified. There is not weak_ptr usage or raw pointer. Every times a shared_ptr is passed, its using the ref counter of the = operator. It prevents unexpected behaviour and hangs. ## References My previous PR 1148 was bad quality. you can cancel it. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [X] Closes #1058 [X] Cancel PR https://github.com/microsoft/terminal/pull/1148/ [X] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] Tests added/passed * [ ] Requires documentation to be updated [X ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx ## Detailed Description of the Pull Request / Additional comments Previous commit was a mistake, it involves modifcations and both the migration to vs2019 and platform toolset v142. The new PR is juts handling H/CPP modifications. Worked in VS2017 OK. ## Validation Steps Performed Manuel test of running tab and ask for cmd and type command, and ask for history... --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:03:42 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24507