mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-06 22:29:43 +00:00
the final_release thing Dustin was talking about. I think I still need to synchronously close the connection though
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "pch.h"
|
||||
#include "ContentProcess.h"
|
||||
#include "ContentProcess.g.cpp"
|
||||
#include "ControlCore.h"
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
@@ -30,6 +31,39 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
#pragma warning(disable : 4722)
|
||||
ContentProcess::~ContentProcess()
|
||||
{
|
||||
// if (_interactivity)
|
||||
// {
|
||||
// if (_interactivity.Core())
|
||||
// {
|
||||
// // IMPORTANT!
|
||||
// //
|
||||
// // We're responsible for closing the conntection now. If we
|
||||
// // don't do this, the OpenConsole will leak.
|
||||
// _interactivity.Core().Close();
|
||||
// }
|
||||
// }
|
||||
|
||||
// // DANGER - We're straight up going to EXIT THE ENTIRE PROCESS when we
|
||||
// // get destructed. This eliminates the need to do any sort of
|
||||
// // ref-counting weirdness. This entire process exists to host one
|
||||
// // singular ContentProcess instance. When we're destructed, it's because
|
||||
// // every other window process was done with us. We can die now, knowing
|
||||
// // that our job is complete.
|
||||
|
||||
// std::exit(0);
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
winrt::fire_and_forget ContentProcess::final_release(std::unique_ptr<ContentProcess> ptr) noexcept
|
||||
{
|
||||
winrt::com_ptr<ControlCore> coreImpl;
|
||||
coreImpl.copy_from(winrt::get_self<ControlCore>(ptr->_interactivity.Core()));
|
||||
if (coreImpl)
|
||||
{
|
||||
co_await wil::resume_foreground(coreImpl->Dispatcher(), winrt::Windows::System::DispatcherQueuePriority::Normal);
|
||||
coreImpl->Close();
|
||||
}
|
||||
|
||||
// DANGER - We're straight up going to EXIT THE ENTIRE PROCESS when we
|
||||
// get destructed. This eliminates the need to do any sort of
|
||||
// ref-counting weirdness. This entire process exists to host one
|
||||
@@ -39,7 +73,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
std::exit(0);
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
Control::ControlInteractivity ContentProcess::GetInteractivity()
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
ContentProcess(winrt::guid g);
|
||||
~ContentProcess();
|
||||
static winrt::fire_and_forget final_release(std::unique_ptr<ContentProcess> ptr) noexcept;
|
||||
|
||||
bool Initialize(Control::IControlSettings settings,
|
||||
Control::IControlAppearance unfocusedAppearance,
|
||||
|
||||
@@ -218,6 +218,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
UpdateSettings(settings, unfocusedAppearance);
|
||||
}
|
||||
|
||||
winrt::Windows::System::DispatcherQueue ControlCore::Dispatcher()
|
||||
{
|
||||
return _dispatcher;
|
||||
}
|
||||
|
||||
ControlCore::~ControlCore()
|
||||
{
|
||||
Close();
|
||||
|
||||
@@ -193,6 +193,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
uint64_t OwningHwnd();
|
||||
void OwningHwnd(uint64_t owner);
|
||||
|
||||
winrt::Windows::System::DispatcherQueue Dispatcher();
|
||||
|
||||
RUNTIME_SETTING(double, Opacity, _settings->Opacity());
|
||||
RUNTIME_SETTING(bool, UseAcrylic, _settings->UseAcrylic());
|
||||
|
||||
|
||||
@@ -2043,6 +2043,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// Disconnect the TSF input control so it doesn't receive EditContext events.
|
||||
TSFInputControl().Close();
|
||||
_autoScrollTimer.Stop();
|
||||
// THIS IS IMPORTANT!
|
||||
//
|
||||
// If we're out of proc, the control can be closed, but we DON'T
|
||||
// want that to close our content. We'll want the content proc's
|
||||
// teardown to be responsible for closing the core.
|
||||
if (!_contentIsOutOfProc())
|
||||
{
|
||||
_core.Close();
|
||||
|
||||
Reference in New Issue
Block a user