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

Check for multiple application instances #1702

Merged
merged 2 commits into from
Jun 8, 2022

Conversation

scribblemaniac
Copy link
Member

@scribblemaniac scribblemaniac commented Mar 22, 2022

On startup this will check if there is another instance of Pencil2D already running. If there is, the user will be warned of the issues that can arise from running multiple instances of Pencil2D simultaneously (as a result of the shared temporary folder directory and shared preferences file).

This check is done by creating a lock file and lock it on startup. If the locking fails, the warning is shown. If Pencil2D crashes, the lock file will remain and will be stale, however Qt has some checks under the hood that will check for running processes and match the process id and name so that in this case, the next instance of Pencil2D will still be able to successfully acquire the lock and no warning will be produced.

Screenshot from 2022-03-21 22-13-28

@scribblemaniac scribblemaniac added Enhancement UX Related to the way users interact with the program 🔹 Minor PR (only one reviewer required) labels Mar 22, 2022
@MrStevns
Copy link
Member

Tested on Mac OS and works as expected.
Maybe we should check this for release builds only though? I'm often launching multiple instances of Pencil2D to test various things, I'd still like to be able to do that without having to comment out that piece of code or interacting with that popup on each launch. What do you think?

@scribblemaniac
Copy link
Member Author

Perhaps it could be disabled from builds from source, but I think it should still run the check for nightly builds. An average user could conceivably try to run multiple nightly builds or a nightly build and a release build at the same time. Would this work for you?

@MrStevns
Copy link
Member

Perhaps it could be disabled from builds from source, but I think it should still run the check for nightly builds. An average user could conceivably try to run multiple nightly builds or a nightly build and a release build at the same time. Would this work for you?

Sounds good to me 👍

@MrStevns
Copy link
Member

MrStevns commented Jun 8, 2022

Since I know you're busy @scribblemaniac , I took the liberty of adding the flag we talked about. Now it'll be ignored for QT_DEBUG eg. when building DEBUG builds. I'll merge the change now.

Good job 👍

@MrStevns MrStevns merged commit ab2678c into pencil2d:master Jun 8, 2022
@scribblemaniac
Copy link
Member Author

Thanks @MrStevns. I forgot about this and indeed have been very very busy. You change looks good to me.

@MrStevns MrStevns added this to the v0.6.7 milestone Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement 🔹 Minor PR (only one reviewer required) UX Related to the way users interact with the program
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants