Repository: terminal
Issue: Replace use of raw deletable pointers in readDataCooked with shared/weak ptrs
Labels: Product-Conhost,Area-Server,Issue-Task,Area-CodeHealth

# Summary of the new feature/enhancement

In Module Name (readDataCooked.hpp), there is a // TODO MSFT
    // TODO MSFT:11285829 make this something other than a deletable pointer
    // non-ownership pointer
    CommandHistory* _commandHistory;

# Proposed technical implementation details (optional)

In project Host, I would like to encapsulate the _commandHistory raw pointer to CommandHistory as a std::shared_ptr<CommandHistory>.
I am learning the Host project and I think I can do it.

The main change propagation problem is that:

`
CommandHistory& COOKED_READ_DATA::History() noexcept
{
    return *_commandHistory;
}
`

Should I transform it as a : 
`
std::shared_ptr<CommandHistory> COOKED_READ_DATA::History() noexcept
{
    return _commandHistory; // assume it's a shared_ptr<>
}
`

or should I return a weak_ptr... I would be dirty ! What is your opinion ? The History() fn is used to get the reference and some function use the reference. It's not a problem to change the reference as a shared_ptr, its just the fact I need to make more job. The idea is to be clean so I would prefer to propagate shared_ptr. For a ISO C++, it's better. weak_ptr should be used for legacy stuff thunking layers stuff but for new C++ project, unique_ptr<> & shared_ptr<> everywhere is the rule.

Tell me and I can do it.

There are changes to propagate because the pointer is used as that (Find In Files):
Code	File	Line	Column
_commandHistory{ CommandHistory },	D:\Dev\Terminal\src\host\readDataCooked.cpp	64	5
return _commandHistory != nullptr;	D:\Dev\Terminal\src\host\readDataCooked.cpp	142	12
return *_commandHistory;	D:\Dev\Terminal\src\host\readDataCooked.cpp	147	13
if (_commandHistory)	D:\Dev\Terminal\src\host\readDataCooked.cpp	387	9
if (_commandHistory)	D:\Dev\Terminal\src\host\readDataCooked.cpp	1025	17
LOG_IF_FAILED(_commandHistory->Add({ _backupLimit, StringLength / sizeof(wchar_t) },	D:\Dev\Terminal\src\host\readDataCooked.cpp	1029	31
CommandHistory* _commandHistory;	D:\Dev\Terminal\src\host\readDataCooked.hpp	142	21
cookedReadData._commandHistory = pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandLineTests.cpp	81	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandListPopupTests.cpp	113	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandListPopupTests.cpp	157	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandListPopupTests.cpp	198	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandListPopupTests.cpp	239	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandListPopupTests.cpp	277	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandListPopupTests.cpp	315	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandListPopupTests.cpp	355	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandListPopupTests.cpp	386	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandListPopupTests.cpp	417	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandListPopupTests.cpp	459	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandListPopupTests.cpp	498	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandListPopupTests.cpp	543	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandNumberPopupTests.cpp	92	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandNumberPopupTests.cpp	137	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandNumberPopupTests.cpp	166	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandNumberPopupTests.cpp	214	28
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CommandNumberPopupTests.cpp	260	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CopyToCharPopupTests.cpp	91	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CopyToCharPopupTests.cpp	126	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CopyToCharPopupTests.cpp	157	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CopyToCharPopupTests.cpp	197	24
cookedReadData._commandHistory = m_pHistory;	D:\Dev\Terminal\src\host\ut_host\CopyToCharPopupTests.cpp	238	24