OpenChemistry / avogadroapp

Avogadro is an advanced molecular editor designed for cross-platform use in computational chemistry, molecular modeling, bioinformatics, materials science, and related areas.
https://two.avogadro.cc/
BSD 3-Clause "New" or "Revised" License
179 stars 69 forks source link

segmentation fault occurs by `avogadro2 filename` #494

Open e-kwsm opened 2 weeks ago

e-kwsm commented 2 weeks ago

Avogadro version: (please complete the following information from the About box):

Desktop version: (please complete the following information):

Describe the bug Segmentation fault occurs when a filename is passed to avogadro2.

To Reproduce

1

He 0.0 0.0 0.0

Save the above XYZ as He.xyz and

$ ./prefix/bin/avogadro2 He.xyz
…
"Checking for formatScripts scripts in path /var/lib/flatpak/exports/share/OpenChemistry/Avogadro/formatScripts"
"Checking for formatScripts scripts in path /usr/local/share/OpenChemistry/Avogadro/formatScripts"
"Checking for formatScripts scripts in path /usr/share/OpenChemistry/Avogadro/formatScripts"
"Checking for formatScripts scripts in path prefix/bin/../lib/avogadro2/scripts/formatScripts"
zsh: segmentation fault (core dumped)  ./prefix/bin/avogadro2 He.xyz

AppImage does not work either:

$ Avogadro2-x86_64.AppImage He.xyz
…
Python interpreter "/opt/hostedtoolcache/Python/3.11.7/x64/bin/python3" does not exist trying "python" in your path. Please set a path to the python interpreter.
zsh: segmentation fault (core dumped)  Avogadro2-x86_64.AppImage He.xyz
(lldb) r He.xyz
…
"Checking for formatScripts scripts in path prefix/bin/../lib/avogadro2/scripts/formatScripts"
Process 304317 stopped and restarted: thread 1 received signal: SIGCHLD
Process 304317 stopped and restarted: thread 1 received signal: SIGCHLD
Process 304317 stopped and restarted: thread 1 received signal: SIGCHLD
Process 304317 stopped
* thread #1, name = 'avogadro2', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0xc0)
    frame #0: 0x00007ffff6901f90 libAvogadroCore.so.1`Avogadro::Core::Layer::activeLayer(this=0x00000000000000b8) const at layer.cpp:82:10
   79   
   80   size_t Layer::activeLayer() const
   81   {
-> 82     return m_activeLayer;
   83   }
   84   
   85   size_t Layer::maxLayer() const
(lldb) bt
* thread #1, name = 'avogadro2', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0xc0)
  * frame #0: 0x00007ffff6901f90 libAvogadroCore.so.1`Avogadro::Core::Layer::activeLayer(this=0x00000000000000b8) const at layer.cpp:82:10
    frame #1: 0x00007ffff7e4453c libAvogadroQtPlugins.so.1`Avogadro::QtPlugins::LayerWireframe& Avogadro::QtGui::PluginLayerManager::getSetting<Avogadro::QtPlugins::LayerWireframe>(this=0x0000555555e3bba0, layer=18446744073709551615) at pluginlayermanager.h:86:38
    frame #2: 0x00007ffff7e41009 libAvogadroQtPlugins.so.1`Avogadro::QtPlugins::Wireframe::setupWidget(this=0x0000555555e3bb90) at wireframe.cpp:183:62
    frame #3: 0x00007ffff7b0da87 libAvogadroQtGui.so.1`Avogadro::QtGui::ScenePluginModel::data(QModelIndex const&, int) const at scenepluginmodel.cpp:89:34
    frame #4: 0x00007ffff75f55b4 libQt5Widgets.so.5`QStyledItemDelegate::initStyleOption(QStyleOptionViewItem*, QModelIndex const&) const + 692
    frame #5: 0x00007ffff75f9c91 libQt5Widgets.so.5`QStyledItemDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const + 625
    frame #6: 0x00007ffff764915f libQt5Widgets.so.5`QTreeView::indexRowSizeHint(QModelIndex const&) const + 927
    frame #7: 0x00007ffff764939d libQt5Widgets.so.5`QTreeViewPrivate::itemHeight(int) const + 157
    frame #8: 0x00007ffff764d856 libQt5Widgets.so.5`QTreeViewPrivate::updateScrollBars() + 566
    frame #9: 0x00007ffff764dbbb libQt5Widgets.so.5`QTreeView::updateGeometries() + 267
    frame #10: 0x00007ffff738f1ca libQt5Widgets.so.5`QWidget::event(QEvent*) + 1306
    frame #11: 0x00007ffff743af88 libQt5Widgets.so.5`QFrame::event(QEvent*) + 40
    frame #12: 0x00007ffff64aaf02 libQt5Core.so.5`QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) + 146
    frame #13: 0x00007ffff7356321 libQt5Widgets.so.5`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 129
    frame #14: 0x00007ffff64aba68 libQt5Core.so.5`QCoreApplication::notifyInternal2(QObject*, QEvent*) + 296
    frame #15: 0x00007ffff7389ac6 libQt5Widgets.so.5`QWidgetPrivate::sendPendingMoveAndResizeEvents(bool, bool) + 342
    frame #16: 0x00007ffff738e14a libQt5Widgets.so.5`QWidgetPrivate::show_helper() + 58
    frame #17: 0x00007ffff738e7a7 libQt5Widgets.so.5`QWidgetPrivate::setVisible(bool) + 439
    frame #18: 0x00007ffff738e5b3 libQt5Widgets.so.5`QWidgetPrivate::showChildren(bool) + 339
    frame #19: 0x00007ffff738e168 libQt5Widgets.so.5`QWidgetPrivate::show_helper() + 88
    frame #20: 0x00007ffff738e5ca libQt5Widgets.so.5`QWidgetPrivate::showChildren(bool) + 362
    frame #21: 0x00007ffff738e168 libQt5Widgets.so.5`QWidgetPrivate::show_helper() + 88
    frame #22: 0x00007ffff738e7a7 libQt5Widgets.so.5`QWidgetPrivate::setVisible(bool) + 439
    frame #23: 0x00007ffff738e5b3 libQt5Widgets.so.5`QWidgetPrivate::showChildren(bool) + 339
    frame #24: 0x00007ffff738e168 libQt5Widgets.so.5`QWidgetPrivate::show_helper() + 88
    frame #25: 0x00007ffff738e7a7 libQt5Widgets.so.5`QWidgetPrivate::setVisible(bool) + 439
    frame #26: 0x000055555556d659 avogadro2`main at avogadro.cpp:316:14
    frame #27: 0x00007ffff5c39c88 libc.so.6`___lldb_unnamed_symbol3256 + 120
    frame #28: 0x00007ffff5c39d4c libc.so.6`__libc_start_main + 140
    frame #29: 0x000055555556dac5 avogadro2`_start + 37

If avogadro2 is launched without arguments and then open the file, no error is issued.

Expected behavior Segmentation fault does not occur.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here. Please consider uploading or linking test files.

welcome[bot] commented 2 weeks ago

Thanks for opening your first issue here! Please try to include example files and screenshots if possible. If you're looking for support, please post on our forum: https://discuss.avogadro.cc/

ghutchis commented 2 weeks ago

Can you please check with HEAD? I'm pretty sure we fixed this one.

e-kwsm commented 2 weeks ago

Thank you for your reply.

I checked out avogadro from those as of openchemistry/openchemistry@cc83c17d6144036ed95432abae921fb7f03f6933 to the latest, OpenChemistry/avogadroapp@782aa89a96b72a9ac9750aa0613d8e0e9dd1268b and OpenChemistry/avogadrolibs@22c94831a26eb62f7041dd4cc99195fb6fb0ab4a, then it works.

Would you release a new version?