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

Exit MultiMC after Instance has closed #1873

Closed
Zocker1999NET opened this Issue Apr 29, 2017 · 5 comments

Comments

Projects
None yet
3 participants
@Zocker1999NET

Zocker1999NET commented Apr 29, 2017

System Information

MultiMC version: 0.5.0-develop-971

Operating System: Windows 10 Pro - Build 16179.1000

Summary of the problem:

MultiMC stays open after closing any instance whether the instance was started with the MultiMC UI or with a shortcut using the command "-l myInstance". There is no setting to let MultiMC automatically close after an instance was exited without any error.

The problem is, for example, if I add MultiMC to my Steam Library and configure the launch settings to start my main instance automatically, Steam does recognize MultiMC as the game. The Overlay and Configurations for the Steam Controller work perfect, but after closing Minecraft, Steam does not see this and so it is showing my friends I am playing Minecraft until MultiMC is closed as well.

What should be added:

There should be added an option to enable a feature like this. It would also be great if MultiMC could close itself only if the instance was launched with the command line.

@QuImUfu

This comment has been minimized.

QuImUfu commented Apr 30, 2017

i think this is a good suggestion for an additional command line switch. A workaround for the moment would be adding

Taskkill /IM MultiMC.exe 

as a post exit command. (hope this works, can't test it)
This would however lead to MultiMC exiting even if the instance is started out of MultiMC.

If you want to make it more advanced and make it exit only if started over steam you could start MultiMC with a script that creates some flag file before starting MultiMC and have another script as post exit command that exits MultiMC only if the flag file exists and deletes the flag file. I can sadly not make and post scripts for this as i am not using Windows.

@Zocker1999NET

This comment has been minimized.

Zocker1999NET commented Apr 30, 2017

Your idea is great, but it does not work with any modification as I had expected it.
MultiMC does not want to close because it thinks an instance is still running because the post-exit command is seen as part of the instances. I have added the parameter /F to force MultiMC to exit. Now it works as expected.

Complete post-exit command is now in my case: taskkill /F /IM MultiMC.exe
I think it is not even bad if MultiMC closes even after I had started the instance out of MultiMC so that is no problem for me.

Thanks for your workaround!

@peterix peterix added the idea label Apr 30, 2017

@peterix

This comment has been minimized.

Member

peterix commented Apr 30, 2017

So, some ideas and issues related to this:

The reason why a main window is even created when launching a single instance directly is that there's still too much of the application logic attached to it. I was getting crashes without it and wanted to release 0.5.0 ASAP.

peterix added a commit that referenced this issue Apr 30, 2017

@peterix peterix added multimc: bug and removed idea labels Apr 30, 2017

@peterix

This comment has been minimized.

Member

peterix commented Apr 30, 2017

Alright, I fixed it up a bit.

  • The main window is no longer created when launching individual instances from command line.
  • The main window was not reference counted properly and would prevent the application from quitting.
  • Quit when all the reference counts of running instances/windows run out didn't work.

Effectively, it should work. Try the develop version :)

@peterix

This comment has been minimized.

Member

peterix commented May 2, 2017

MultiMC will now exit after an instance is closed, as long as there are no windows left behind.
It will not create a main window, unless you actually launch it normally.
Direct launch of instance does not - by default - not create an instance window. This has to be enabled in the settings, or the instance has to crash.

I consider this a good enough solution until MultiMC can track running instances even through its own restart.

Closing {#1873, #1874, #1875}

@peterix peterix closed this May 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment