Crash on exit #1243

Closed
opened 2026-01-30 22:20:01 +00:00 by claunia · 6 comments
Owner

Originally created by @andy-yx-chen on GitHub (May 22, 2019).

Environment

Windows build number: [run "ver" at a command prompt]
Microsoft Windows [Version 10.0.18362.53]   
Windows Terminal version (if applicable):
build from master branch
Any other software?
none

Steps to reproduce

close the terminal and you will get it, double Release call

Expected behavior

Actual behavior

Originally created by @andy-yx-chen on GitHub (May 22, 2019). <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: [run "ver" at a command prompt] Microsoft Windows [Version 10.0.18362.53] Windows Terminal version (if applicable): build from master branch Any other software? none ``` # Steps to reproduce close the terminal and you will get it, double Release call <!-- A description of how to trigger this bug. --> # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior <!-- What's actually happening? -->
Author
Owner

@zadjii-msft commented on GitHub (May 22, 2019):

I would have thought that this was #627, which should have been fixed by #746. Can you post a stack of the double release you're seeing?

@zadjii-msft commented on GitHub (May 22, 2019): I would have thought that this was #627, which should have been fixed by #746. Can you post a stack of the double release you're seeing?
Author
Owner
@andy-yx-chen commented on GitHub (May 22, 2019): > Microsoft.UI.Xaml.Markup.dll!winrt::impl::root_implements<winrt::Microsoft::UI::Xaml::Markup::implementation::XamlApplication,winrt::Microsoft::UI::Xaml::Markup::XamlApplication,winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProviderContainer,winrt::Windows::Foundation::IClosable,winrt::composable,winrt::composing,winrt::Windows::UI::Xaml::IApplicationOverrides,winrt::Windows::UI::Xaml::IApplicationOverrides2,winrt::Windows::UI::Xaml::Markup::IXamlMetadataProvider>::Release() Line 6413 C++ Microsoft.UI.Xaml.Markup.dll!winrt::implements<winrt::Microsoft::UI::Xaml::Markup::implementation::XamlApplication,winrt::Microsoft::UI::Xaml::Markup::XamlApplication,winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProviderContainer,winrt::Windows::Foundation::IClosable,winrt::composable,winrt::composing,winrt::Windows::UI::Xaml::IApplicationOverrides,winrt::Windows::UI::Xaml::IApplicationOverrides2,winrt::Windows::UI::Xaml::Markup::IXamlMetadataProvider>::Release() Line 6954 C++ Microsoft.UI.Xaml.Markup.dll!winrt::impl::produce_base<winrt::Microsoft::UI::Xaml::Markup::implementation::XamlApplication,winrt::Microsoft::UI::Xaml::Markup::IXamlApplication,void>::Release() Line 6085 C++ The problem could be solved by Increase the reference for TerminalApp, but that does not make sense to me though
Author
Owner

@andy-yx-chen commented on GitHub (May 22, 2019):

namespace winrt::TerminalApp::implementation
{

    App::App() :
        App(winrt::TerminalApp::XamlMetaDataProvider())
    {
    }

    App::App(Windows::UI::Xaml::Markup::IXamlMetadataProvider const& parentProvider) :
        base_type(parentProvider),
        _settings{  },
        _tabs{  },
        _loadedInitialSettings{ false }
    {
        // For your own sanity, it's better to do setup outside the ctor.
        // If you do any setup in the ctor that ends up throwing an exception,
        // then it might look like App just failed to activate, which will
        // cause you to chase down the rabbit hole of "why is App not
        // registered?" when it definitely is.
        **this->AddRef();**
    }
@andy-yx-chen commented on GitHub (May 22, 2019): ``` namespace winrt::TerminalApp::implementation { App::App() : App(winrt::TerminalApp::XamlMetaDataProvider()) { } App::App(Windows::UI::Xaml::Markup::IXamlMetadataProvider const& parentProvider) : base_type(parentProvider), _settings{ }, _tabs{ }, _loadedInitialSettings{ false } { // For your own sanity, it's better to do setup outside the ctor. // If you do any setup in the ctor that ends up throwing an exception, // then it might look like App just failed to activate, which will // cause you to chase down the rabbit hole of "why is App not // registered?" when it definitely is. **this->AddRef();** } ```
Author
Owner

@zadjii-msft commented on GitHub (May 22, 2019):

That's almost certainly not the correct solution to this bug, even if it might work.

I am seeing some other problems on exit, so we can use this to track following up on this issue.

I got some RoOriginateError in App::_RemoveTabViewItem on this line:

_tabs.erase(_tabs.begin() + tabIndexFromControl);
@zadjii-msft commented on GitHub (May 22, 2019): That's almost certainly not the correct solution to this bug, even if it might work. I am seeing some other problems on `exit`, so we can use this to track following up on this issue. I got some RoOriginateError in `App::_RemoveTabViewItem` on this line: ``` _tabs.erase(_tabs.begin() + tabIndexFromControl); ```
Author
Owner

@metathinker commented on GitHub (May 23, 2019):

Could this be the same issue as #457? @DHowett-MSFT said about that bug:

This is also the cause of a crash when closeOnExit is true and you exit the last shell.

And since PR #599 was merged, closeOnExit is indeed the default behavior.

@metathinker commented on GitHub (May 23, 2019): Could this be the same issue as #457? @DHowett-MSFT said about that bug: > This is also the cause of a crash when `closeOnExit` is true and you exit the last shell. And since PR #599 was merged, `closeOnExit` is indeed the default behavior.
Author
Owner

@zadjii-msft commented on GitHub (May 23, 2019):

Oh yea, this probably is a dupe of that one. Good catch!

@zadjii-msft commented on GitHub (May 23, 2019): Oh yea, this probably is a dupe of that one. Good catch!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1243