Results 1 to 20 of 28

Thread: (Another) segmentation fault

Hybrid View

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

    Default Re: (Another) segmentation fault

    I am using that.
    Qt Code:
    1. void GlavnoO::test_clicked()
    2. {
    3. bool ok = FALSE;
    4. QSqlDatabase *baza = QSqlDatabase::database();
    5. if (baza) {
    6. ok = baza->isOpen();
    7. };
    To copy to clipboard, switch view to plain text mode 
    Originally it was without 'if (baza) ...' statement.

  2. #2
    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

    So what's wrong with that? The form you use it in doesn't matter. You can use QSqlDatabase::database() from anywhere. Just makesure addDatabase() has been invoked earlier.

  3. The following user says thank you to wysota for this useful post:

    Lebowski (6th April 2006)

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

    Default Re: (Another) segmentation fault

    Yep, it does work now!! Thanx all.

    Seems I was missing QSqlDatabase::database() statement so my 'baza' pointer had a random value.

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.