-
Notifications
You must be signed in to change notification settings - Fork 912
wsd: clean up the coolwsd process cleanup #13357
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
wsd/COOLWSD.cpp
Outdated
| try | ||
| { | ||
| innerMain(); | ||
| returnValue = cleanup(EXIT_OK); |
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.
cleanup can now be called multiple times; that doesn't smell like a good design
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 suppose if it throws. I moved it out, so if it throws that ends the process promptly.
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.
Sorry, I don't get you What I meant was that when the call to cleanup in the try block threw, the catch blocks would have called cleanup a second time. (But you seem to have addressed that in b92c610 now, anyway?)
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.
Yes, that's what I meant by "if it throws" in the try, we'd call it (cleanup) again it the catch. Yes, addressed it.
wsd/COOLWSD.cpp
Outdated
|
|
||
| if constexpr (Util::isMobileApp()) | ||
| Util::forcedExit(returnValue); | ||
|
|
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.
for IOS, all the above code wasn't originally executed, but now is
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.
True. But on iOS we never run unit tests. Still, best to exclude them.
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 not only about the
if (UnitBase::isUnitTesting())
but also about e.g. the
if constexpr (Util::isMobileApp())
Util::forcedExit(returnValue);
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.
Yes, understood. Addressed.
57cfe33 to
b92c610
Compare
I find the github PR review interface extremely hostile and hardly usable. Now, it appears that your new commit has a different parent than your old commit, so the "Compare" button leads to a page full of noise. I don't know how to meaningfully review such a PR. |
Understood. These are the diffs due to rebasing. I'll try to avoid that in the future. Meanwhile, I'm hoping the PR is small enough, and your comments few enough that you can look at the parts we discussed. I'm hoping the changes are minor enough that you'll tell me if you still have any concerns. |
wsd/COOLWSD.cpp
Outdated
| void COOLWSD::cleanup([[maybe_unused]] int returnValue) | ||
| int COOLWSD::cleanup(int returnValue) | ||
| { | ||
| if constexpr (Util::isMobileApp()) |
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 shouldn't be done for IOS (for which Util::isMobileApp() is true AFAIU)
|
And, on second thought, moving the So, if you want to move the call to there after all (on the, somewhat dubious, grounds that mobile apps don't run unit tests and thus don't need |
b92c610 to
665778f
Compare
Thanks, @stbergmann. This makes sense. I tried to retain the original IOS code while making sure that we do call the unit-test uninit in the case of exceptions. I rebased, forgetting that it messes the diff. Please take a look at the diff as it is. It is now closer to the original and should be easy to re-review. Thanks for your detailed reviews. Appreciated. |
665778f to
8ed7273
Compare
Change-Id: Id1266613699f80350cc9a2098e63b3e76eca7ad7 Signed-off-by: Ashod Nakashian <[email protected]>
8ed7273 to
f81ab4a
Compare
Simplifies the cleanup process at exit and ensures that
cleanup()is always called.