-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Remove ATL dependencies (#676) #719
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
Conversation
| // set GUID_PROP_CONIME_TRACKCOMPOSITION | ||
| // | ||
| CComPtr<ITfProperty> PropertyTrackComposition; | ||
| wil::com_ptr_nothrow<ITfProperty> PropertyTrackComposition; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the application of com_ptr_nothrow is correct, but I was surprised to see that all of these use the non-throwing version of wil's com_ptr since I assumed at least a few cases should throw an exception instead.
Was the new use verified to ensure that the nothrow variant matches the previous behavior in all cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look at atlcomcli.h and found operator* in CComPtrBase throws expection.
T& operator*() const
{
ATLENSURE(p!=NULL);
return *p;
}
#define ATLENSURE(expr) ATLENSURE_THROW(expr, E_FAIL)
So here we can use wil::com_ptr instead of wil::com_ptr_nothrow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would wait for one of the Terminal team members to respond before changing this. But my intuition is that it was correct to use com_ptr_nothrow for the query cases, but the others should be com_ptr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we were still discussing in the issue if com_ptr_nothrow is actually needed in TSF or not. I'd say that it isn't, exceptions can come from query functions but we actually need the "try" versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look at atlcomcli.h and found operator* in CComPtrBase throws expection.
Yes but wil's com_ptr does not. Besides, I don't think I've seen any uses of this particular operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CEditSessionObject::_GetTextAndAttributeGapRange function is already a little broken in that we were calling std::wstring.append here which I believe can technically throw in memory situations and we weren't catching it.
What I'd do here is wrap the entire function body in:
try
{
}
CATCH_RETURN();
return S_OK;
And just use the throwable versions of wil::com_ptr and continue to use the std::wstring.append inside of that.
That will ensure that any exception that might be thrown now or in future refactorings will be appropriately caught and HRESULT-ified for the COM caller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added try blocks only for CompGuid.insert and CompStr.append.
|
I think these changes are basically correct, but I'm going to defer formal review to the Terminal project team. This looks like excellent work overall. |
|
The last project uses ATL is |
zadjii-msft
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable, but I want to make sure the rest of the team gets their eyes on it.
| std::basic_string_view<WORD> colorArray(colors.data(), colors.size()); | ||
|
|
||
| return ImeComposeData(text, attributes, colorArray); | ||
| return ImeComposeData(CompStr, attributes, colorArray); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nicer to rename the parameter to text instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should rename it. It has it's meaning.
f007b2f to
d5e84bb
Compare
I don't like the idea of implementing our own Otherwise, the only other thing I can think of is to go back to old school CRT |
|
Most of the fuzzer needs are pretty simple, you can use just |
a1333e7 to
ebc8b74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this is exactly what I was looking for when I made the issue. Thank you so much for stepping up here. Just cleanup the outstanding threads and we're good to go.
|
@miniksa Yes. |
|
@ysc3839 sure go for it. |
|
fuzzing_directed.h uses CComAllocator: terminal/src/terminal/parser/ft_fuzzer/fuzzing_directed.h Lines 28 to 30 in a12521f
And there's comments about it: terminal/src/terminal/parser/ft_fuzzer/fuzzing_directed.h Lines 329 to 342 in a12521f
So can we just copy CCRTAllocator implementation? |
Yeah, I'd just do that and rename it slightly or put it into a namespace of our own so it never conflicts. |
|
@miniksa Any update? |
|
@ysc3839, sorry, I have been swamped. There's too many of you and too few of me. I'll look. |
|
OK, I double checked. I'm good with this. I'm trying to get another FTE to sign off. |
|
Hello @miniksa! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me and give me an instruction to get started! Learn more here. |
|
@msftbot hold this pr for the next 2 hours |
|
Hello @zadjii-msft! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
zadjii-msft
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm giving @DHowett-MSFT a chance to get his eyes on this PR, but I think it's fine
DHowett-MSFT
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. Thank you!
Related discussion #676.