OpenHantek / openhantek

OpenHantek is a DSO software for Hantek (Voltcraft/Darkwire/Protek/Acetech) USB digital signal oscilloscopes
http://openhantek.org/
GNU General Public License v3.0
771 stars 199 forks source link

Segfault enabling "math" after fiddling with sample rates #183

Closed FauxFaux closed 6 years ago

FauxFaux commented 6 years ago

When I fiddle with sample rates, then enable the "math" channel, OpenHantek segfaults. If I change the sample rate with math enabled, it aborts.

Linux (Ubuntu 17.04). Version: HEAD (https://github.com/OpenHantek/openhantek/commit/7ed6776abc00e61b095c11b42c9109ee1542d4a9) Device: DSO-6022BE.

Segfault:

Thread 1 "OpenHantek" received signal SIGSEGV, Segmentation fault.
0x00005555555dd25e in DataChannel::computeAmplitude (this=0x7fffd0092090) at /home/faux/code/openhantek/openhantek/src/post/ppresult.cpp:23
23      minimalVoltage = maximalVoltage = voltage.sample[0];
(gdb) bt
#0  0x00005555555dd25e in DataChannel::computeAmplitude (this=0x7fffd0092090) at /home/faux/code/openhantek/openhantek/src/post/ppresult.cpp:23
#1  0x0000555555591aac in DsoWidget::showNew (this=0x7fffe4002800, data=std::shared_ptr (count 3, weak 0) 0x7fffc8005000) at /home/faux/code/openhantek/openhantek/src/dsowidget.cpp:503
#2  0x00005555555cd9a8 in MainWindow::showNewData (this=0x7fffffffcdc0, data=std::shared_ptr (count 3, weak 0) 0x7fffc8005000) at /home/faux/code/openhantek/openhantek/src/mainwindow.cpp:294
#3  0x00005555555c940b in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<std::shared_ptr<PPresult> >, void, void (MainWindow::*)(std::shared_ptr<PPresult>)>::call (f=
    (void (MainWindow::*)(MainWindow * const, std::shared_ptr<PPresult>)) 0x5555555cd95e <MainWindow::showNewData(std::shared_ptr<PPresult>)>, o=0x7fffffffcdc0, arg=0x7fffc8005e70)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:136
#4  0x00005555555c8f63 in QtPrivate::FunctionPointer<void (MainWindow::*)(std::shared_ptr<PPresult>)>::call<QtPrivate::List<std::shared_ptr<PPresult> >, void> (f=
    (void (MainWindow::*)(MainWindow * const, std::shared_ptr<PPresult>)) 0x5555555cd95e <MainWindow::showNewData(std::shared_ptr<PPresult>)>, o=0x7fffffffcdc0, arg=0x7fffc8005e70)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:169
#5  0x00005555555c8a3b in QtPrivate::QSlotObject<void (MainWindow::*)(std::shared_ptr<PPresult>), QtPrivate::List<std::shared_ptr<PPresult> >, void>::impl (which=1, this_=0x555555e3ad70, r=0x7fffffffcdc0, a=0x7fffc8005e70, 
    ret=0x0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject_impl.h:120
#6  0x00007ffff6119452 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007ffff6ea54d3 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#8  0x00007ffff6f92bab in QMainWindow::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9  0x00007ffff6e6446c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007ffff6e6bd34 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007ffff60e9de8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007ffff60ec55d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007ffff6142e53 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007ffff3434fb7 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007ffff34351f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ffff343527c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007ffff614247f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007ffff60e7e3a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007ffff60f0da4 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00005555555c67c2 in main (argc=1, argv=0x7fffffffe348) at /home/faux/code/openhantek/openhantek/src/main.cpp:199

Abort:

ASSERT failure in QList<T>::operator[]: "index out of range", file /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h, line 549

Thread 1 "OpenHantek" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff51c5f5d in __GI_abort () at abort.c:90
#2  0x00007ffff5ef7107 in QMessageLogger::fatal(char const*, ...) const () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007ffff5ef23ba in qt_assert_x(char const*, char const*, char const*, int) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00005555556041d7 in QList<double>::operator[] (this=0x555555e68940, i=10) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:549
#5  0x0000555555603da1 in SiSpinBox::stepBy (this=0x555555e68900, steps=1) at /home/faux/code/openhantek/openhantek/src/widgets/sispinbox.cpp:127
#6  0x00007ffff6f45dcd in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#7  0x00007ffff6f461e7 in QAbstractSpinBox::mousePressEvent(QMouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#8  0x00007ffff6ea571f in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9  0x00007ffff6f496a5 in QAbstractSpinBox::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007ffff6e6446c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007ffff6e6c28f in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007ffff60e9de8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007ffff6e6b262 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#14 0x00007ffff6ebf94b in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007ffff6ec1fba in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff6e6446c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff6e6bd34 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007ffff60e9de8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007ffff66a8f43 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#20 0x00007ffff66aaa25 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#21 0x00007ffff6682cab in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#22 0x00007fffeda7a5a0 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#23 0x00007ffff3434fb7 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007ffff34351f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007ffff343527c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007ffff614247f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#27 0x00007ffff60e7e3a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#28 0x00007ffff60f0da4 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#29 0x00005555555c67c2 in main (argc=1, argv=0x7fffffffe348) at /home/faux/code/openhantek/openhantek/src/main.cpp:199
davidgraeff commented 6 years ago

The patch from @dendvz should help here. If it doesn't work, please reopen this issue