Results 1 to 5 of 5

Thread: Can QSessionManager be used for crash problems ?

  1. #1
    Join Date
    Feb 2009
    Posts
    189
    Thanks
    2

    Default Can QSessionManager be used for crash problems ?

    Dear friends

    Can QSessionManager be used for crash problems ? Means if anything happend to the application if it crashed or power interrupted , can we use QSessionManager to save the last session and next time when it starts it should start from there. I appreciate for any on this . Thanks sujan

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Can QSessionManager be used for crash problems ?

    I don't think so. You would have to restart the application with a session id manually and to do that you would have to first find the session id which can be troublesome. It will be much easier to take a snapshot of your application state now and then and save it in QSettings.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Can QSessionManager be used for crash problems ?

    OK, but how save the last snapshot of my app before any crash ? I at the moment I am using the qApp signal aboutToQuit().
    How find the way to save the stuff in QSettings when we kill the process ?

    I am trying to use QSessionManager and commitDataRequest() signal, but it does not work for me.

    Any ideas ?

  4. #4
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Can QSessionManager be used for crash problems ?

    aboutToQuit() is for graceful termination. You are interested in crashes.

    AFAIK there is no Qt abstraction that gives you a chance to execute arbitrary code when the program is about to crash. A crash occurs when the program performs an illegal operation, such as an invalid memory access. Your OS probably offers a way to install a handler to react to such an event. For instance, Unix sends signals such as SIGSEGV. However, at that point your program is so corrupted that I would not rely too much on high-level abstractions like QSettings if I were you.

    If you worry about crashes, why don't you act before it is too late and save the application's state with QSettings from time to time, for instance using a QTimer? Many programs like text editors do just that.

  5. #5
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Can QSessionManager be used for crash problems ?

    OK, thanx, QTimer I think is the best option to do it.

Similar Threads

  1. Replies: 2
    Last Post: 23rd July 2010, 14:53
  2. Crash gracefully?
    By ultim8 in forum Qt Programming
    Replies: 7
    Last Post: 7th July 2010, 04:00
  3. Crash gracefully? No crash!
    By lni in forum Qt Programming
    Replies: 0
    Last Post: 7th July 2010, 03:59
  4. QSessionManager example request
    By oguzy in forum Qt Programming
    Replies: 0
    Last Post: 30th September 2008, 21:53
  5. Crash report
    By Lele in forum Qt Programming
    Replies: 6
    Last Post: 10th October 2007, 09:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.