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

fix: trigger external change handling when reloading sessions #1061

Merged
merged 5 commits into from Mar 26, 2022

Conversation

ouuan
Copy link
Member

@ouuan ouuan commented Mar 8, 2022

Description

Save the timestamp when saving the session. When restoring a session, compare the timestamp with the file modification time. If the file is newer than the session, trigger an external file change event.

Related Issues / Pull Requests

This should fix #1059.

Motivation and Context

#1059, and this can also prevent accidentally overriding external file changes when CP Editor is not running.

How Has This Been Tested?

On Arch Linux,

  1. external file changes when CP Editor is not running
  2. kill CP Editor by SIGKILL to simulate abnormal exit

Checklist

  • If the key of a setting is changed, the old attribute is updated or it is resolved in SettingsUpdater.
  • If there are changes of the text displayed in the UI, they are wrapped in tr() or QCoreApplication::translate().
  • If needed, I have opened a pull request or an issue to update the documentation.
  • If these changes are notable, they are documented in CHANGELOG.md.

@ouuan ouuan requested a review from coder3101 March 8, 2022 07:01
@ouuan ouuan marked this pull request as draft March 8, 2022 07:12
@ouuan ouuan marked this pull request as ready for review March 8, 2022 07:25
@ouuan ouuan enabled auto-merge (squash) March 9, 2022 05:15
@ouuan ouuan requested review from swiftqwq and coder3101 and removed request for coder3101 March 25, 2022 08:06
@ouuan ouuan merged commit 9ab5bbf into master Mar 26, 2022
@ouuan ouuan deleted the restore-session-external-change branch March 26, 2022 15:30
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.

Code may be Accidentally Lost when Autosave is Turned on
2 participants