Closed Bug 922814 Opened 12 years ago Closed 12 years ago

nsIAppStartup.shuttingDown is reset to false during shutdown

Categories

(Toolkit :: Startup and Profile System, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: smacleod, Assigned: Yoric)

References

Details

(Whiteboard: [Async Shutdown])

Attachments

(1 file, 1 obsolete file)

Both nsAppExitEvent (http://mxr.mozilla.org/mozilla-central/source/toolkit/components/startup/nsAppStartup.cpp#111 ) and nsAppStartup::Quit (http://mxr.mozilla.org/mozilla-central/source/toolkit/components/startup/nsAppStartup.cpp#459 ) reset nsIAppStartup.shuttingDown to false when the application is definitely shutting down. This causes problems for any code relying on |shuttingDown| which is still executing after the flag is reset, such as the final session store file write - see Bug 922785
Looking at the source code of nsAppStartup.cpp, it is not quite clear why we set |mShuttingDown = false|. There is a comment "turn off the reentrancy check flag" that makes me wary of getting rid of all occurrences of |mShuttingDown = false|. Ehsan, since you are the author of one of these occurrences, could you tell us whether you think we would be breaking something?
Flags: needinfo?(ehsan)
(In reply to David Rajchenbach Teller [:Yoric] from comment #1) > Ehsan, since you are the author of one of these occurrences, could you tell > us whether you think we would be breaking something? Did you look at the change I made there? :-) I just replaced PR_FALSE with false across our code base, I don't know anything about this code.
Flags: needinfo?(ehsan)
(Note that getting useful blames for the code often involves looking at the actual changes and blaming on the parent revisions if the changes do not seem to match what you're looking for.)
Oops :) Hey, look what I found – that piece of code was written by a certain bsmedberg, a long time ago, in a galaxy far far away: https://github.com/jrmuizel/mozilla-cvs-history/commit/3055933c278e6a315788ee06fade12ac152a0159
Comment on attachment 812842 [details] [diff] [review] Once the application is shutting down, it remains shutting down until there is no more application Review of attachment 812842 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/startup/nsAppStartup.cpp @@ -456,5 @@ > > - // turn off the reentrancy check flag, but not if we have > - // more asynchronous work to do still. > - if (!postedExitEvent) > - mShuttingDown = false; After looking at this again, this case should probably be left in. We only reset |mShuttingDown| here when |!postedExitEvent|, so we aren't actually shutting down right now from this call to nsAppStartup::Quit. I suspect the culprit for the unexpected reset is just that other case you removed.
I'm not quite clear. It's the nsAppExitEvent that used to reset mShuttingDown to false. The snippet you mention performs the reset even if for some reason we haven't posted that event.
Attachment #812842 - Flags: review?(benjamin)
Assignee: nobody → dteller
Comment on attachment 812842 [details] [diff] [review] Once the application is shutting down, it remains shutting down until there is no more application smacleod is correct. The hunk at the bottom of nsAppStartup::Quit needs to stay in so that if we are using eConsiderQuit or eAttemptQuit and we decided *not* to quit that the flag reverts to its normal false state.
Attachment #812842 - Flags: review?(benjamin) → review-
Whiteboard: [Async Shutdown]
Attachment #814871 - Flags: review?(benjamin) → review+
Keywords: checkin-needed
Whiteboard: [Async Shutdown] → [Async Shutdown][fixed-in-fx-team]
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [Async Shutdown][fixed-in-fx-team] → [Async Shutdown]
Target Milestone: --- → mozilla27
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: