Results 1 to 20 of 28

Thread: (Another) segmentation fault

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: (Another) segmentation fault

    Try this:

    $ gdb ./povezava
    (gdb) run
    (some output will go there and eventually the application will segfault)
    (gdb) bt


    and show us the result of "bt".

  2. #2
    Join Date
    Apr 2006
    Location
    Slovenia
    Posts
    33
    Thanks
    5
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: (Another) segmentation fault

    Here is what I get with gdb:
    (gdb) run
    Starting program: /home/simon/projects/dbconn/povezava
    Reading symbols from shared object read from target memory...done.
    Loaded system supplied DSO at 0xb9e000
    [Thread debugging using libthread_db enabled]
    [New Thread -1208837664 (LWP 9818)]

    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread -1208837664 (LWP 9818)]
    0x04d45bb5 in QSqlDatabase::isOpen (this=0xffff) at sql/qsqldatabase.cpp:772
    772 return d->driver->isOpen();
    (gdb) bt
    #0 0x04d45bb5 in QSqlDatabase::isOpen (this=0xffff) at sql/qsqldatabase.cpp:772
    #1 0x0804bcb0 in GlavnoO::test_clicked (this=0xbff491fc) at .ui/../glavnoo.ui.h:28
    #2 0x0804e877 in GlavnoO::qt_invoke (this=0xbff491fc, _id=52, _o=0xbff48af8) at .moc/moc_glavnoo.cpp:87
    #3 0x04ab9eb4 in QObject::activate_signal (this=0x9967440, clist=0x9969488, o=0xbff48af8) at kernel/qobject.cpp:2355
    #4 0x04aba374 in QObject::activate_signal (this=0x9967440, signal=4) at kernel/qobject.cpp:2324
    #5 0x04e39c7e in QButton::clicked (this=0xffff) at .moc/release-shared-mt/moc_qbutton.cpp:152
    #6 0x04b59a63 in QButton::mouseReleaseEvent (this=0x9967440, e=0xbff48e54) at widgets/qbutton.cpp:836
    #7 0x04af8187 in QWidget::event (this=0x9967440, e=0xbff48e54) at kernel/qwidget.cpp:4699
    #8 0x04a550dd in QApplication::internalNotify (this=0xffff, receiver=0x9967440, e=0xbff48e54) at kernel/qapplication.cpp:2635
    #9 0x04a5603f in QApplication::notify (this=0xbff49334, receiver=0x9967440, e=0xbff48e54) at kernel/qapplication.cpp:2421
    #10 0x049ec746 in QETWidget::translateMouseEvent (this=0x9967440, event=0xbff49118) at kernel/qapplication.h:518
    #11 0x049eaf01 in QApplication::x11ProcessEvent (this=0xbff49334, event=0xbff49118) at kernel/qapplication_x11.cpp:3468
    #12 0x049ff008 in QEventLoop:rocessEvents (this=0x9944fe0, flags=Variable "flags" is not available.
    ) at kernel/qeventloop_x11.cpp:192
    #13 0x04a6d82b in QEventLoop::enterLoop (this=0x9944fe0) at kernel/qeventloop.cpp:198
    #14 0x04a6d736 in QEventLoop::exec (this=0x9944fe0) at kernel/qeventloop.cpp:145
    #15 0x04a54aa9 in QApplication::exec (this=0xbff49334) at kernel/qapplication.cpp:2758
    #16 0x0804bc31 in main (argc=1, argv=0xbff49414) at main.cpp:19
    (gdb) Quit
    (gdb)

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

    Default Re: (Another) segmentation fault

    Can we see the current code too?

  4. #4
    Join Date
    Apr 2006
    Location
    Slovenia
    Posts
    33
    Thanks
    5
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: (Another) segmentation fault

    Code is still the same as it was in the first post.

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

    Default Re: (Another) segmentation fault

    Then this code is surely invalid as you have a local variable "baza" which points to the database and a member variable "baza" which points to some garbage which probably causes a crash.

  6. #6
    Join Date
    Apr 2006
    Location
    Slovenia
    Posts
    33
    Thanks
    5
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: (Another) segmentation fault

    Possible. But why doesn't compiler find any errors? And how do i change the code to make it work?

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

    Default Re: (Another) segmentation fault

    Why should it find errors? The code is valid C++, it just doesn't do what you wnt. Zlatko already told you how to correct it.

Similar Threads

  1. segmentation fault for no apparent reason
    By rishiraj in forum Newbie
    Replies: 1
    Last Post: 12th February 2009, 11:13
  2. segmentation fault
    By uchennaanyanwu in forum Newbie
    Replies: 3
    Last Post: 31st July 2008, 16:52
  3. Process aborted. Segmentation fault
    By Pragya in forum Qt Programming
    Replies: 3
    Last Post: 30th May 2007, 08:12
  4. Segmentation fault running any QT4 executables
    By jellis in forum Installation and Deployment
    Replies: 7
    Last Post: 19th May 2007, 16:35
  5. Icons missing => segmentation fault
    By antonio.r.tome in forum Qt Programming
    Replies: 4
    Last Post: 8th March 2006, 16:30

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
  •  
Qt is a trademark of The Qt Company.