Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break everything out of App except Xaml platform init #3465

Merged
merged 4 commits into from
Nov 7, 2019

Conversation

miniksa
Copy link
Member

@miniksa miniksa commented Nov 7, 2019

Summary of the Pull Request

This removes anything in App that isn't the base stuff to set up XAML. This will be necessary for dual-heading it with Centennial & UWP hosts

References

This is part of #3236 but I had to re-do it anyway because of merges. I want to get it submitted so people stop adding stuff to App.

PR Checklist

  • I work here
  • Existing tests should still pass
  • I'm a core contributor

Detailed Description of the Pull Request / Additional comments

@ocalvo tells me that app shouldn't have anything in it but just the init and onload. So I moved everything else to AppLogic and glued it back together.

Validation Steps Performed

Ran the project and launched it locally.

@miniksa miniksa requested review from DHowett-MSFT and zadjii-msft and removed request for DHowett-MSFT November 7, 2019 00:01
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally a little confused about the ownership of the AppLogic, so I want some answers before I sign off

dialog.CloseButtonText(buttonText);

_ShowDialog(nullptr, dialog);
static AppLogic logic;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not a member of App? You could wait to instantiate it until this is first called.

Copy link
Member Author

@miniksa miniksa Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DHowett-MSFT, as far as I can see, the magic static is safer than the alternative as it cannot accidentally be referenced from elsewhere in the class without being allocated and will only be allocated deferred to the first call.

Doing what Mike says opens us up to a null check on the instance variable, theoretically. But this is indeed magic and maybe we shouldn't magic?

const auto& warnings = _settings->GetWarnings();
for (const auto& warning : warnings)
// if this is a UWP... it means its our problem to hook up the content to the window here.
if (_isUwp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this path isn't supposed to work right now, correct? It looks to me like at the end of this block, the logic is going to have it's refcount decremented and it'll get cleaned up. Seems like the App would need to hang onto it as a member... but I could be wrong.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work right now in that there's no Universal head showing in the project. But this code does totally work correctly if you invoke from a Universal context.

It's not going to be cleaned up. It has an outstanding reference in the static right now due to the "magic static" as far as I know after the first call and won't be cleaned, just wait for future use.

@miniksa
Copy link
Member Author

miniksa commented Nov 7, 2019

So @zadjii-msft, @DHowett-MSFT, I think none of us care strongly enough about this to change it. Can I just leave it then as is so I can get onto the good bit of making the UWP work and not worrying about App?

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can dig it

@DHowett-MSFT DHowett-MSFT changed the title Break everything out of App except the base initialization Break everything out of App except Xaml platform init Nov 7, 2019
@DHowett-MSFT DHowett-MSFT merged commit 3e8a1a7 into master Nov 7, 2019
@DHowett-MSFT DHowett-MSFT deleted the dev/miniksa/split_app branch November 7, 2019 21:11
@ghost
Copy link

ghost commented Nov 26, 2019

🎉Windows Terminal Preview v0.7.3291.0 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants