Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

App crashes when using 2 TableWidgets



  • I'm using two QTableWidgets in a master/slave relationship. When I click on a customer name in the master, the slave shows me various customer information. Simple enough, you'd think.

    If I click a customer in the master and click nothing in the slave, then click another customer name in the master, all is okay. If I click a customer in the master and click a cell in the slave, then click back on the same customer name in the master, all is okay. But if I click any cell of the slave and then try to select another customer in the master, the app crashes. The only way to keep from crashing is to click in a spot in the slave table that isn't a cell.

    The only thing I'm using on the slave table is a cellChanged event. And simply clicking into a cell isn't changing anything. So I don't have a clue as to why I'm crashing when I select customer B in the master, followed by clicking in a cell of the slave, then clicking back in the master for customer A.

    What's happening under the hood here?


  • Lifetime Qt Champion

    Hi
    Run it via debugger and inspect the stack trace to see what is happening.
    It could be in some cases you are accessing a NULL ptr or you manage to
    get some sort of recursion happing with the signal.



  • @mrjj - I've decided that I'm not so far in to this that my work can be considered set in stone. So I'm going to tear it all down and start anew, learn how to properly use these Qt tools and never look back. I'll be here to ask more questions; you can count on that. But I'm done with trying to fit a size-6 shoe on a size-12 foot.


Log in to reply