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

Don't attempt to show the prefs on relaunch if the window isn't open when quitting, fixes #526 #962

Merged
merged 2 commits into from Jul 12, 2012

Conversation

pjrobertson
Copy link
Member

@pjrobertson pjrobertson commented Jun 26, 2012

Just a simple check to see if the Prefs window is visible before attempting to setenv

@skurfer
Copy link
Member

skurfer commented Jun 26, 2012

An annoying problem. So glad to see it fixed. Even though I see it all the time, I’m having trouble reproducing it at will. I can’t tell much of a difference in behavior between this and master.

This only applies to a relaunch, right? If you launch fresh, it’s a different environment?

In either branch, it seems I have to restart a couple of times with the prefs open to make the window appear on start up, but then once it does, it comes up on every restart (even if I close it first). I don’t see anywhere that the QSVisiblePrefPane environment variable gets cleared. Seems like it should after it’s been read in QSController so it doesn’t influence the next relaunch. Right?

@pjrobertson
Copy link
Member Author

pjrobertson commented Jun 28, 2012

The method described in #526 by the user reproduced the problem reliably for me.

I don't really understand environments. I was thinking it may be better to store and read a BOOL from the prefs (user defaults)

Thoughts?

@skurfer
Copy link
Member

skurfer commented Jun 29, 2012

OK, I’ve figured it out. I was right that the environment needs to be cleared up at some point.

You’ve fixed part of the bug by making sure the window won’t be visible if it wasn’t visible on shutdown. But for the case where it was visible on shut down, and it (correctly) shows on relaunch, you can’t ever get rid of it. If you close the window and relaunch (even several times), it always comes back.

Adding this on line 77-78 seems to fix it.

} else {
    unsetenv("QSVisiblePrefPane");

I don't really understand environments.

Me either. I’ve never seen it used in C before, but I don’t think it’s any different from the variables in your shell. The environment does seem to persist during relaunches, but not on a fresh launch, which is why we need to use unsetenv(). You could get more complicated, I guess, by checking the current state with getenv() and deciding what to do. But I think my “dumb” fix works.

skurfer added a commit that referenced this pull request Jul 12, 2012
Don't attempt to show the prefs on relaunch if the window isn't open when quitting, fixes #526
@skurfer skurfer merged commit 34c2ed6 into quicksilver:master Jul 12, 2012
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.

None yet

2 participants