Version: HEAD (using KDE KDE 3.3.0) Installed from: Compiled From Sources OS: Linux PROBLEM: Kst crashes when the user attempts to modify the number of bins in a histogram STEPS TO REPRODUCE: Start Kst Create a simple plot Create a histogram in a new plot Edit the newly created histogram Change the value of "Num bins:" Hit OK RESULTS: Crash EXPECTED RESULTS: Number of bins is changed
Stack trace: Using host libthread_db library "/lib/tls/libthread_db.so.1". [Thread debugging using libthread_db enabled] [New Thread -174471488 (LWP 15887)] [New Thread -178676816 (LWP 15888)] [Thread debugging using libthread_db enabled] [New Thread -174471488 (LWP 15887)] [New Thread -178676816 (LWP 15888)] [Thread debugging using libthread_db enabled] [New Thread -174471488 (LWP 15887)] [New Thread -178676816 (LWP 15888)] [KCrash handler] #4 0xf6fe97a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 #5 0xf5b0e955 in raise () from /lib/tls/libc.so.6 #6 0xf5b10319 in abort () from /lib/tls/libc.so.6 #7 0x081ab028 in KstHistogram::setNBins (this=0x9671b88, in_n_bins=185) at ksthistogram.cpp:306 #8 0x0810497e in KstHsDialogI::edit_I (this=0x957ae90) at kstsharedptr.h:132 #9 0x081068dd in KstHsDialogI::OK (this=0x957ae90) at dataobjectdialog.h:95 #10 0x081069de in KstHsDialogI::qt_invoke (this=0x957ae90, _id=60, _o=0xfef33970) at ksthsdialog_i.moc:121 #11 0xf60bbda0 in QObject::activate_signal () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #12 0xf60bc47a in QObject::activate_signal () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #13 0xf63f3fc0 in QButton::clicked () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #14 0xf614b9f7 in QButton::mouseReleaseEvent () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #15 0xf60f1cfa in QWidget::event () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #16 0xf605d249 in QApplication::internalNotify () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #17 0xf605d489 in QApplication::notify () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #18 0xf66a54c8 in KApplication::notify () from /usr/lib/libkdecore.so.4 #19 0xf5ffc3de in QETWidget::translateMouseEvent () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #20 0xf5ffac78 in QApplication::x11ProcessEvent () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #21 0xf600d086 in QEventLoop::processEvents () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #22 0xf6072875 in QEventLoop::enterLoop () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #23 0xf60727ce in QEventLoop::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #24 0xf605c44b in QApplication::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3 #25 0x0814ec96 in main (argc=1, argv=0xfef34e94) at main.cpp:747
That's an abort() and was placed in there on purpose. It's incomplete code. (only crashes on debug compiles)
CVS commit by staikos: Finish the code here BUG: 102382 BUG: 102386 M +8 -8 ksthistogram.cpp 1.56 --- kdeextragear-2/kst/kst/ksthistogram.cpp #1.55:1.56 @@ -138,4 +138,6 @@ void KstHistogram::commonConstructor(con v->setProvider(this); _hVector = _outputVectors.insert(HIST, v); + + setDirty(); } @@ -187,7 +189,5 @@ KstObject::UpdateType KstHistogram::upda _W = (_MaxX - _MinX)/double(_NBins); - for (i_bin = 0; i_bin < _NBins; i_bin++) { - Bins[i_bin] = 0; - } + memset(Bins, 0, _NBins*sizeof(*Bins)); ns = _inputVectors[RAWVECTOR]->length(); @@ -292,5 +293,6 @@ void KstHistogram::internalSetNBins(int } Bins = new unsigned long[_NBins]; - _W = (_MaxX - _MinX)/(double)_NBins; + memset(Bins, 0, _NBins*sizeof(*Bins)); + _W = (_MaxX - _MinX)/double(_NBins); _NS = 3 * _NBins + 1; @@ -304,6 +306,4 @@ void KstHistogram::setNBins(int in_n_bin internalSetNBins(in_n_bins); setDirty(); - abort(); // FIXME - update(); // Have to update here otherwise Bins[] is invalid! }