sorry for my bad English.
Currently I have an application has 2 components: 1 widget for QgsMapCanvas (called A) to load map and action on it, and 1 widget window for control action (called B).
Once I draw a line on A window, then select this line, data of this lines will be loaded to a tableView on B. I got 2 problems here:
- Sometimes it crashed when select line.
- Sometimes it loaded data to table successfully, but when I clicked on view of A, it crashed also.
I using GDB debugger already, but it seems stop at return a.exec() only, hard to find the reason. Anyone has clue for this odd issues? Thanks.
I used Valgrind to check memory then it shows
Invalid read of size 8 in TableModel::insertRows(int, int, QModelIndex const&) in /home/lavie/QT_workspace/CPS_V2_MAP/CPS_MAPS_WGET_GIS/cps_tablemodel.cpp:133
This is code segment of: cps_tablemodel.cpp:133
bool TableModel::insertRows(int position, int rows, const QModelIndex &index) {
Q_UNUSED(index);
beginInsertRows(QModelIndex(), position, position+rows-1);
for (int row=0; row < rows; row++) {
CPS_Target_LandMark mark = CPS_Target_LandMark(0, 0, 0, 0, 0, 0);
target_marks.insert(position, mark);
}
endInsertRows(); // line 133 here
return true;
}