Skip to content

Desktop: Fix #1790: Stop print command from resetting theme #1999

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

Merged
merged 1 commit into from
Oct 31, 2019

Conversation

aerotog
Copy link
Contributor

@aerotog aerotog commented Oct 16, 2019

Fixes #1790.

This solution uses a simple print flag to reduce the chance of triggering the race condition. It's not as foolproof as an async lock, but I cannot reproduce the bug with the change added, and this check is much faster than a lock would be.

@tessus
Copy link
Collaborator

tessus commented Oct 17, 2019

I did some testing with your code and it happened to me that after pressing ctrl+p rapidly a few times the print dialog stopped working. So even after pressing ctrl+p once, no print dialog shows up.

Update: Also, the theme still switches to light when printing, although it switches back right after.

@aerotog
Copy link
Contributor Author

aerotog commented Oct 17, 2019

the theme still switches to light when printing

My understanding of the expected behavior is that the Light theme is enabled while printing and then should return back to the original configured theme.

pressing ctrl+p rapidly a few times the print dialog stopped working

That also happens in master. I believe that is a related but different bug from the theme resetting. In my testing, my change doesn't seem to make that behavior worse.

I'll take a look at the prompt being disabled, but I have a feeling that will be harder to fix.

@aerotog
Copy link
Contributor Author

aerotog commented Oct 20, 2019

I've tried a few strategies to avoid the disabling of the print prompt but haven't had any success. The primary strategy was adding a timeout to my new isPrinting_ flag but it didn't help.

Like I said before, the temporary disabling of the print prompt exists in master and my change doesn't seem to make it any worse, so I don't think it should be considered a blocker for merging the theme reset fix.

If we decide not to take the current theme reset fix, I suggest re-purposing the original issue to address both the temporary prompt being disabled and the theme resetting.

@laurent22
Copy link
Owner

Thanks for the PR @aerotog, it indeed fixes this particular bug. For the other issue, we might need a different fix.

@laurent22 laurent22 merged commit 3167466 into laurent22:master Oct 31, 2019
scoroi pushed a commit to scoroi/joplin that referenced this pull request Nov 10, 2019
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.

Pressing Ctrl+P twice rapidly, switches to light theme [minor bug]
3 participants