Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Mac: Brackets won't quit in subsequent sessions after using Dev Tools #5989

Closed
couzteau opened this issue Nov 14, 2013 · 28 comments
Closed

Mac: Brackets won't quit in subsequent sessions after using Dev Tools #5989

couzteau opened this issue Nov 14, 2013 · 28 comments

Comments

@couzteau
Copy link
Member

  1. Run brackets
  2. open test runner chrome debug tools
  3. quit brackets
  4. restart brackets.
  5. Now brackets won’t quit unless I run quit from the OSX dock.

results:
At step 3 I'd expect my chrome dev tools to close. But they stay open
At step 5 I'd expect brackets to quit via CMD-Q or via Quit from menu

Env OSX 10.7, 10.8, 10.9


Slightly simplified steps:

  1. Run Brackets
  2. Debug > Show Developer Tools
  3. Close Brackets
  4. Do not close Chrome
  5. Restart Brackets
  6. Cmd-Q

Results:
Bracket won't quit

@jasonsanjose
Copy link
Member

I'm seeing this too on 10.7. But in step 2 I don't open the unit test window, I just go straight to Debug > Show Developer Tools.

@JeffryBooher
Copy link
Contributor

@jasonsanjose are you running OSX 10.9 as well? Just wondering if it's something new with 10.9

@JeffryBooher
Copy link
Contributor

N/M @jasonsanjose -- I see you e-mail now that you see it on 10.7

@jasonsanjose
Copy link
Member

@redmunds would this closed PR fix this? adobe/brackets-shell#374

@redmunds
Copy link
Contributor

@fungl164 Can you take a look at this one? I'm wondering if it has something to do with your recent Chrome changes.

@redmunds
Copy link
Contributor

@jasonsanjose I was just trying that. I'm not sure why, but Dev Tools still open in Chrome live-dev profile with that branch (randy/dev-tools-no-debug-connection), so problem is not fixed.

@redmunds
Copy link
Contributor

Doh! I forgot to rebuild. That branch does fix it if Chrome is not running, but Dev Tools fail to launch if Chrome is already running. I'll play around with it.

@peterflynn
Copy link
Member

Updated title to clarify that this only occurs in dev tools related workflows.

@redmunds
Copy link
Contributor

I can also hit problem with this scenario:

  1. Open Brackets
  2. Start Live Dev
  3. In Chrome window with Live Dev (i.e. live-dev profile), open a new Tab
  4. In new Tab, go to localhost:9234 and click on the Dev Tools link
  5. Close and restart Brackets

So, opening Dev Tools in Chrome with default profile may not be enough to fix this problem because you can manually open Dev Tools in Chrome window with live-dev profile.

@redmunds
Copy link
Contributor

Note that this only happens on Mac.

When I try to reproduce on Windows, when Brackets is shutdown, I see a message in Chrome Dev Tools window: "Detached from Target. Remote Debugging has been terminated with reason target_closed. Please re-attach to new target".

I don't see that message in Chrome window on Mac.

@fungl164
Copy link
Contributor

@redmunds et al. I'm on #brackets irc if you want to chat...

@fungl164
Copy link
Contributor

Based on the symptoms and behavior, I believe the problem is most likely that the native app is for some reason not closing the main window. I'm not sure if this is the proper place to force quit the app on exit, but if seems to fix the problem. see (https://github.com/fungl164/brackets-shell/tree/devtools-close)

@fungl164
Copy link
Contributor

@redmunds this should work without any changes to the current master (e.g. no gist edits)

@redmunds
Copy link
Contributor

@fungl164 Thanks for continuing to look at this. The problem is definitely that Brackets is not properly terminating.

Unfortunately your suggestion won't work in the case where there are unsaved documents at shutdown. Instead of prompting user to save documents, it shuts down immediately so unsaved changes are lost.

@fungl164
Copy link
Contributor

@redmunds is there some code already available that can be called to ensure files are saved (either in the appshell or in brackets)?

@redmunds
Copy link
Contributor

@fungl164 Yes, but it's getting caught in the infinite messaging loop, so it never makes it to termination.

@fungl164
Copy link
Contributor

@redmunds which loop? can you point me to it?

@jasonsanjose
Copy link
Member

Do we need to go so far as specifically opening Chrome for dev tools?

Looking at the old sprint 33 code, we don't need any of the flags that we used to pass:

--remote-debugging-port=9222 
--allow-file-access-from-files

And in sprint 34, we certainly don't need --temp-profile. Couldn't we get away with something simpler:

[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://localhost:9234"]];

It seems like overkill for brackets.app.showDeveloperTools to go through the same hoops as opening live preview URLs.

Only brackets devs and extension authors will use dev tools. Given that assumption, it's not a terrible experience for those targeted users to end up in the wrong browser if they happen to not use Chrome or Safari as their default browser.

@fungl164
Copy link
Contributor

@jasonsanjose we tried that last night.

The problem comes down to how the shared workspace chooses the browser instance to open the URL arg. It basically picks the last active window, so if the LiveDev instance had the last focus, we still have the same problem.

@redmunds
Copy link
Contributor

@fungl164 It's not a simple loop. brackets-shell sends FILE_CLOSE_WINDOW message to brackets, which ultimately either returns with FILE_CLOSE or APP_ABORT_QUIT (but I may have the order reversed). In the middle of this process may be other messages to save files to disk.

@jasonsanjose We worked on this last night. I was going to explain the status at the 10am standup.

@redmunds
Copy link
Contributor

Changed this to High Priority and Sprint 34 Milestone.

@fungl164
Copy link
Contributor

@redmunds we may have a shot at fixing it if we look at implementing applicationShouldTerminate app delegate listener method and then handle the saves there.

@redmunds
Copy link
Contributor

@fungl164 Need the brackets UI to prompt user to Save, Discard, or Cancel, so I don't think that will work.

@jasonsanjose
Copy link
Member

Plan B is in place, reverting the 3 pull requests related to the chrome profile changes: adobe/brackets-shell#381. Testing the build now.

@fungl164
Copy link
Contributor

@redmunds if anything, it could at least delay actual app close until all outstanding file saves are done by returning an NSTerminateLater; but ok if its not worth it.

@redmunds
Copy link
Contributor

@fungl164 Sorry, but we ran out of time for Sprint 34 and have to backout this feature. Thanks again for your effort.

For Sprint 35, hopefully we get Dev Tools working in a Brackets window so we don't have to worry about this. Otherwise, we'll need to fix this bug.

@fungl164
Copy link
Contributor

Might be too late for the party, but check out https://github.com/fungl164/brackets-shell/compare/fungl164;chrome-live-osx-2 for a possible fix.

Can safely ignore https://github.com/fungl164/brackets-shell/tree/devtools-close

@redmunds
Copy link
Contributor

Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants