Results 1 to 7 of 7

Thread: QtCored5.dll crashes when "dragging" TableItems

  1. #1

    Question QtCored5.dll crashes when "dragging" TableItems

    Hi,
    I've subclassed QAbstractTableModel and reimplemented the neccessary functions for it. It contains a 2-dimensional-Array of QTableWidgetItems* that hold the Data to be displayed.
    The QTableView, that holds the Model gets modified with "setSelectionBehavior(QAbstractItemView::SelectRow s)" and "setSelectionMode(QAbstractItemView::SingleSelecti on)".
    My biggest concern right now is the "dragging"(holding left click on an Item and moving the Mouse/Cursor). Even if the cursor only moves 1 pixel the application crashes with an exception in Qt5Cored.dll (Accessviolation).
    This Crash does not occur, when i comment out the SingleSelection.

    I've also disabled every drag-drop option I could find (setDragDropMode, setDragEnabled, setDragDropoverwriteMode, viewport()->setAcceptDrops()) though, that didn't help.
    My Question now is: What function could Qt also try while "dragging" a QTableWidgetItem? What can I change, that the crash won't occur while stil having SingleSelection?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    3,929
    Thanks
    229
    Thanked 615 Times in 605 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QtCored5.dll crashes when "dragging" TableItems

    The crash is probably due to your code making a call using a null or uninitialized pointer, writing or reading past the end of an array and causing memory corruption, trying to use a pointer to an object that has already been deletedetc.. If you aren't checking to see that pointers are valid before using them or checking that array accesses are within bounds, it will cause an access violation if the pointer is not valid.

    It is simply a coincidence that the crash occurs in QtCore5.dll. It may not even have anything to do with drag and drop either; whatever has been done earlier to corrupt memory might not appear until that point. Something you are doing in your code is causing the crash, not Qt.
    <=== 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.

  3. #3

    Default Re: QtCored5.dll crashes when "dragging" TableItems

    Don't know if this is a duplicate Messege from me, but the firstone seemingly dissappeard.
    I'm not 100% certain, that I don't do something terribly wrong with the pointers. Still the problem needs to be linked with "setSelectionBehavior(QAbstractItemView::SingleSel ection)" because if that line isn't in the Code, it won't crash.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    3,929
    Thanks
    229
    Thanked 615 Times in 605 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QtCored5.dll crashes when "dragging" TableItems

    Then you will have to build your application in Debug mode and use the debugger to examine what is happening when the crash occurs. Look at the call stack and see where the calls leave your code and go into Qt DLL code. Put a breakpoint at the beginning of your method, re-run the code and step through it line-by-line when it hits the brakpoint. Examine every pointer and variable to make sure it is what you expect it to be, both local variables (in the method) and member variables of the class your call is in.
    <=== 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.

  5. The following user says thank you to d_stranz for this useful post:

    unsortedTable (9th January 2019)

  6. #5

    Default Re: QtCored5.dll crashes when "dragging" TableItems

    I've tried it out for some time, but didn't get very far. Some files like qcoreapplication.cpp couldn't be opened. The last line where i could set the breakpoint in my code was a.exec(). The last not atomic part of the code that i could find was "sendSpontaeousEvent".
    Now I've given up and reverted back to an old point of my software with an QTableWidget and I'll work around the differences between sorted frontend and backend.
    Anyway, thank you very much for trying to help me, but I'll guess the error is one step above my league(or stupidity ^^).

  7. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    3,929
    Thanks
    229
    Thanked 615 Times in 605 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QtCored5.dll crashes when "dragging" TableItems

    It is pretty hard to give anything more than suggestions about what could be wrong based on just a description of the problem. Without source code, all we can do is guess.
    <=== 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.

  8. #7
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,190
    Thanks
    36
    Thanked 1,489 Times in 1,441 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QtCored5.dll crashes when "dragging" TableItems

    Quote Originally Posted by unsortedTable View Post
    I've subclassed QAbstractTableModel and reimplemented the neccessary functions for it. It contains a 2-dimensional-Array of QTableWidgetItems* that hold the Data to be displayed.
    That is a contradiction.

    You are either using a QAbstractTableModel derived class or QTableWidgetItems.

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 20th November 2015, 11:02
  2. Replies: 3
    Last Post: 16th March 2015, 08:31
  3. Replies: 1
    Last Post: 5th February 2011, 22:14
  4. Replies: 3
    Last Post: 2nd November 2010, 23:36
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 20:05

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.