Internal error: pc 0x0 in read in psymtab, but not in symtab (solved?)



  • I use extensively QMdiSubWindow with a central widget, QDockWidget with a database connection in my application. The QSortFilterProxyModel is shared between the subwindows and the dockwidgets. The data of the model is shown in the dockwidget sometimes with QTreeView and sometimes with QTableView and in the subwindows also with QDataWidgetMapper.

    For some MDI windows I get many times the warning while debugging: 'Internal error: pc 0x0 in read in psymtab, but not in symtab' and now occasionally a crash with ASSERT failure in QVector<T>::operator[]: "index out of range", file etc.

    I looked on the Internet to find an answer but could not come up with a solution. A struggled a few days and made the crash go away but I am not sure whether my solution is the real source of the problem

    The model (a subclassed QSortFilterProxyModel) creates the QDataWidgetMapper which is used by the subwindow. The subwindow has the tag Qt::WA_DeleteOnClose. In the destructor the model is not deleted when a dockwidget is still using the model. Due to that reason also the datawidgetmapper is not deleted. This seemed to be the problem. The datawidgetmapper is apparently trying to reference the mapped widgets which have been deleted with the subwindow.

    I solved the problem by calling the deleteMapper() function of the model when the subwindow is closed. Funny enough, this was not a problem earlier upto Qt 4.6 and also my models were smaller (less amount of columns in a table).

    Hope this helps others who might have come across the same problem.



  • Hi Rutger,

    Can't tell exactly whats going wrong in you'r code but I've been having similar problem long time ago with random crashes in some moment of development. In my case it turned out that I had some wrong memory/parentship management of widgets and some problems pointers stored in QList.
    Effect was that my project worked in debug mode (with same errors as you have), and crashed in release mode.
    When I've cleaned up my code and set up memory management properly everything started to work well without any debug errors and crashes.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.