Results 1 to 3 of 3

Thread: Application does no longer start in Qt Creator once it has run into segfault in Linux

  1. #1
    Join Date
    Jan 2013
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Application does no longer start in Qt Creator once it has run into segfault in Linux

    Just to add some background. I have been developing on Windows and now want to run on Linux to profile the application using Valgrind.

    I have set up the project in Linux and it runs. Although as soon as i run into any segmentation faults. I get the following message:

    "The program has unexpectedly finished"
    .. exited with code 0

    This is all good and expected.

    Now when i remove the code that is causing the segmentation fault the program still builds without any errors but it will not run in Qt Creator anymore (it will run when manually executing in the terminal). Only way to get it running again normally (as far as i know), is to reboot the system.


    Compile output:
    12:46:46: Running build steps for project FrostBite...
    12:46:46: Configuration unchanged, skipping qmake step.
    12:46:46: Starting: "/usr/bin/make" -w
    make: Entering directory `/home/matoom/projects/FrostBite-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
    cd data/ && /usr/bin/make -f Makefile
    make[1]: Entering directory `/home/matoom/projects/FrostBite-build-desktop-Qt_4_8_1_in_PATH__System__Debug/data'
    make[1]: Nothing to be done for `first'.
    make[1]: Leaving directory `/home/matoom/projects/FrostBite-build-desktop-Qt_4_8_1_in_PATH__System__Debug/data'
    cd gui/ && /usr/bin/make -f Makefile
    make[1]: Entering directory `/home/matoom/projects/FrostBite-build-desktop-Qt_4_8_1_in_PATH__System__Debug/gui'
    make[1]: Nothing to be done for `first'.
    make[1]: Leaving directory `/home/matoom/projects/FrostBite-build-desktop-Qt_4_8_1_in_PATH__System__Debug/gui'
    make: Leaving directory `/home/matoom/projects/FrostBite-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
    12:46:46: The process "/usr/bin/make" exited normally.


    Application output:
    Starting /home/matoom/projects/FrostBite-build-desktop-Qt_4_8_1_in_PATH__System__Debug/frostbite...
    /home/matoom/projects/FrostBite-build-desktop-Qt_4_8_1_in_PATH__System__Debug/frostbite exited with code 0


    Here are the project files that explain the structure in the compile output:
    https://github.com/matoom/frostbite/...er/gui/gui.pro
    https://github.com/matoom/frostbite/.../data/data.pro
    https://github.com/matoom/frostbite/.../FrostBite.pro

    --------

    It seems to me that it tries to run and then exits right away but there is no indication to why.

    My first thought was that it was crashing into Linux background somehow but this does not seem to be the case as i could not find anything in the process (ps) list.

    Any help or hints for debugging this issue would be appreciated.

    Thanks in advance,
    Matoom

  2. #2
    Join Date
    Jan 2013
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Application does no longer start in Qt Creator once it has run into segfault in L

    I figured out why this was happening and it wasn't related to qt creator but i can't find a way to delete this post.

    Just for the odd chance someone runs into this issue. It was cause by using QSharedMemory to allow only single instance of application process to run. In Linux/Unix the shared memory did not get released after application crashed.
    Qt Code:
    1. int main(int argc, char *argv[]) {
    2. QSharedMemory shared(QDir::currentPath());
    3. if(!shared.create(512, QSharedMemory::ReadWrite)) {
    4. Log4Qt::Logger::logger(QLatin1String("ErrorLogger"))->info("Application already running.");
    5. exit(0);
    6. }
    7. ...
    8. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Application does no longer start in Qt Creator once it has run into segfault in L

    Yes, on Unix shared memory is "owned" by the operating system itself: http://qt-project.org/doc/qt-4.8/qsh...y.html#details

    An approach that should work better cross-platform is using a QLocalServer.
    Has the additional benefit that you can use QLocalSocket in the second instance to communicate with the first one, e.g. passing command line arguments of the new invocation.

    Cheers,
    _

Similar Threads

  1. Load the workspace in Qt Creator at start
    By qt_developer in forum Newbie
    Replies: 1
    Last Post: 1st November 2012, 15:50
  2. Replies: 3
    Last Post: 17th July 2012, 21:58
  3. Replies: 5
    Last Post: 25th April 2012, 12:34
  4. Cannot start app in Qt Creator
    By giantdragon in forum Newbie
    Replies: 1
    Last Post: 23rd May 2011, 22:32
  5. QListWidgetItem->text() causing application segfault
    By Valheru in forum Qt Programming
    Replies: 6
    Last Post: 21st August 2006, 23:08

Tags for this Thread

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.