cryos / avogadro

Avogadro 1 is not under active development, the repository was archived in September 2021. Development of Avogadro 2 is being done at https://github.com/openchemistry/avogadrolibs. Avogadro is an advanced molecular editor designed for cross-platform use in computational chemistry, molecular modeling, bioinformatics, materials science, and related areas.
http://avogadro.cc/
GNU General Public License v2.0
334 stars 156 forks source link

Copying segfaults when no unit cell defined #662

Open cryos opened 12 years ago

cryos commented 12 years ago

Avogadro version: 1.1.0 Git: c52ef94

Steps to reproduce: 1) draw some atoms 2) select them 3) select copy avogadro crashes

Valgrind reveals that the culprit is MainWindow::prepareClipboardData(), line 2397. There we have

moleculeCopy->setOBUnitCell (new OBUnitCell(*(d->molecule->OBUnitCell())));

The crash doesn't happen if a unit cell is defined. The reason to the crash is most likely d->molecule->OBUnitCell() being NULL.

Reported by: *anonymous

cryos commented 12 years ago

There's a fix, if you'd like to confirm: http://review.source.kitware.com/#/t/812/

Original comment by: @ghutchis