Results 1 to 9 of 9

Thread: Using QSqlRecord to update QSqlRelationalTableModel - exception on destructor

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2021
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Using QSqlRecord to update QSqlRelationalTableModel - exception on destructor

    It does not happen if the line in the inner loop is commented out

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using QSqlRecord to update QSqlRelationalTableModel - exception on destructor

    Then put some debug output into the loop and/or only add some values and not all to see what happens.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Using QSqlRecord to update QSqlRelationalTableModel - exception on destructor

    using std::move
    Yes, move semantics would be OK.

    data->tableContents.size()
    Is this a constant within the scope of the inner loop?

    auto tableData = data->tableContents.find(row);
    You dereference tableData inside the loop. Is this guaranteed to be a valid pointer?

    This whole thing could be a red herring. too. It might be that there is an error somewhere earlier that has corrupted memory or the stack and is only manifest at this point in the code.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  4. #4
    Join Date
    Jan 2021
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Using QSqlRecord to update QSqlRelationalTableModel - exception on destructor

    Thank you all.

    I was left with two things to test, just took me a while to get around to it.

    So i first wondered if i was setting a part of the relational database which was linked to a foreign key. Although this would probably cause issues later on, it was not causing this issue.

    The issue was simple (and rather daft), i was trying to set a numeric parameter in the database with a string.

  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Using QSqlRecord to update QSqlRelationalTableModel - exception on destructor

    The issue was simple (and rather daft), i was trying to set a numeric parameter in the database with a string.
    None of us have ever made that kind of mistake :-)
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QSqlRelationalTableModel fail update
    By Alexandru in forum Qt Programming
    Replies: 0
    Last Post: 13th June 2018, 17:08
  2. Destructor for Qtconcurrent::Exception?
    By bp45738 in forum Qt Programming
    Replies: 4
    Last Post: 20th September 2011, 18:25
  3. Replies: 2
    Last Post: 26th October 2010, 12:38
  4. Unable to modify QSqlRecord in QSqlRelationalTableModel
    By pippo42 in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2010, 23:17
  5. Replies: 1
    Last Post: 7th June 2008, 18:29

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.