-
Notifications
You must be signed in to change notification settings - Fork 157
Thread problems during moleculeChanged calls #353
Comments
Backtrace for the ASSERT failure: #0 0xb7fba424 in __kernel_vsyscall () Original comment by: @dlonie |
Backtrace for the segfault: #0 0xb6e00fa2 in QMutex::lock () from /usr/bin/../lib/libQtCore.so.4 Original comment by: @dlonie |
This is actually an issue with the MainWindow::setMolecule(Molecule *) slot. If it has a Molecule object pointer already, it will delete that before setting the new molecule. For all the other code we wrote this behaviour was fine and did what we expected. As your code holds onto the molecules and may use them again, it segfaults the second time the molecule is set as you are using a dangling pointer. I will fix this tomorrow probably. I think the best solution is to add a second parameter (enum possibly) with options. Such as DeleteOldMolecule, OpenInNewWindow. There is another case where is the window has a loaded molecule in it, then I would like it to open a new window rather than overwrite the active molecule. In your case you do not want that behaviour. There may be other permutations of this too. Original comment by: @cryos |
I fixed this, but forgot to close the bug report. It appears to be working well now. Original comment by: @cryos |
When calling moleculeChanged to update the mainwindow's widget, I will frequently get one of the following:
ASSERT failure in QReadLocker: "QReadWriteLock pointer is misaligned", file /usr/include/QtCore/qreadwritelock.h, line 132
QMutex::lock: mutex lock failure:
or sometimes just a segfault. It happens during the following call to moleculeChanged -- the debug at the begin appears, but not the last. m_results_list is a QList<Xtal*>*, where Xtal is a class derived from Avogadro::Molecule.
void XtalOptDialog::selectMoleculeFromResults(int row,int,int oldrow,int) {
qDebug() << "XtalOptDialog::selectMoleculeFromResults( " << row << " " << oldrow << " ) called";
if (row == oldrow) return;
emit moleculeChanged(m_results_list->at(row));
qDebug() << "molecule set!";
}
This is happening with the code at this revision of the xtalopt extension: http://github.com/dlonie/avogadro-XtalOpt/commit/a304f765bd2ace3cd42f03af2c9a9946cf1a1f25 . The snippet above comes from the bottom of xtaloptdialog.cpp
Reported by: @dlonie
The text was updated successfully, but these errors were encountered: