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

Modal fixes (#281) #284

Merged
merged 6 commits into from
Dec 22, 2021
Merged

Modal fixes (#281) #284

merged 6 commits into from
Dec 22, 2021

Conversation

awfulcooking
Copy link
Contributor

Pushing commits to this branch, feel free to test / merge, or wait for more to come in.

@makew0rld
Copy link
Owner

Looking good, thanks for this! Let me know when you think it's done.

@@ -156,12 +156,12 @@ func makeNewTab() *tab {
if t.hasContent() {
savePath, err := downloadPage(t.page)
if err != nil {
Error("Download Error", fmt.Sprintf("Error saving page content: %v", err))
go Error("Download Error", fmt.Sprintf("Error saving page content: %v", err))
Copy link
Owner

@makew0rld makew0rld Dec 12, 2021

Choose a reason for hiding this comment

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

My problem with this, and all the other go <modal> calls in this file is that it opens up the possibility of other things happening before the modal is dismissed. I'm not sure what the solution is though. Maybe all the code in t.view.SetInputCapture can be put in a goroutine (with a mutex that blocks multiple versions of it running) that blocks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might be a good situation to ask about in #go-nuts on Libera. I wonder if they'd have any advice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bear in mind the Info() and Error() functions previously just didn't block, but would return as soon as the modal had opened. Using go Info() should give similar behaviour to before, the only difference being that now the parent function may return before the modal has even rendered.

But if anything happened immediately after it the modals rendered, it would have shown UI breakage before #272, I think. And so we could expect this just to be a return to the previous, non-deadlocking behaviour

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fun that we're addressing deadlocking and not-waiting-enough code in one PR :-)
As two sides of one coin.

Copy link
Owner

Choose a reason for hiding this comment

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

Bear in mind the Info() and Error() functions previously just didn't block, but would return as soon as the modal had opened. Using go Info() should give similar behaviour to before, the only difference being that now the parent function may return before the modal has even rendered.

Yep, and that behavior worked well enough in general, so maybe it's fine. I'm just cautiious about future issues caused by this being non-blocking. But it's not a reason to not merge this PR or anything.

But if anything happened immediately after it the modals rendered, it would have shown UI breakage before #272

What makes you say this? Like it would draw focus away from the modal? And how does this PR change that? Seems like it could easily break things if something happened after still.

@awfulcooking
Copy link
Contributor Author

I think we should merge this, test it, and release after a few days if all seems well. Then improve from there!

@makew0rld
Copy link
Owner

I'd rather test before merging, but in general this seems like a good fix for this issue, thanks for your work. As for a release, I gotta see, because I already have a new feature in master (#263), so to make a v1.9.3 release for #283 would require reverting the feature and re-adding it after release. #283 is not a show-stopper bug, so I'm not sure if it merits its own release or not.

Also please see my reply above.

@makew0rld
Copy link
Owner

As for testing, it would probably be best to induce errors, like was done in #281, and make sure there are no UI issues.

@makew0rld
Copy link
Owner

Going to merge this now, having done some testing myself. Thanks for making this patch. I don't intend to make a release for this, but it will be in v1.10.0 of course.

If you have an idea about my comment above that would be appreciated.

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.

2 participants