Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a Qt application and have run into the following problem: when the user logs out or attempts to shut down the machine, the application is instantly terminated without providing it any chance to save any data. I assume the app needs to listen for some event. I tried listening for the SIGTERM signal, but my application was still terminated before it had a chance to respond to the signal.

What options do I have?

share|improve this question

I'm starting to use Qt for application development and I have found a "Session Management" chapter in Qt Reference Documentation. I think you can find some interesting.

A session is a group of running applications, each of which has a particular state. The session is controlled by a service called the session manager. The applications participating in the session are called session clients. [...] Start by reimplementing QApplication::commitData() to enable your application to take part in the graceful logout process. [...]

You can find it here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.