Jürgen Spitzmüller wrote: > Jürgen Spitzmüller wrote: >> However, I have compiled with stdlib-debug enabled. >> I'm just recompiling with --disable-stdlib-debug to check if that makes a >> difference. > > It does. With --disable-stdlib-debug, I don't get the crash either. So are we > doing something invalid that does only surface when stdlib-debug is enabled? > > Jürgen >
Yes, it seems that the stdlib-debug is triggert by the code, as your backtrace indicates: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 47008102289504 (LWP 12243)] 0x0000000000ba8d84 in lyx::frontend::QTocDialog::setTreeDepth (this=0x18d97a0, depth=<value optimized out>) at QTocDialog.C:113 at this place is a huge Qt macro: Q_FOREACH (QModelIndex index, indices) { // I had to use Q_FOREACH instead of foreach if(getIndexDepth(index) < depth_) // because compile flag -DQT_NO_KEYWORDS doesn't allow me.. tocTV->expand(index); //<- line 113 else >From qglobal.h: struct QForeachContainerBase {}; template <typename T> class QForeachContainer : public QForeachContainerBase { public: inline QForeachContainer(const T& t): c(t), brk(0), i(c.begin()), e(c.end()){}; const T c; mutable int brk; mutable typename T::const_iterator i, e; inline bool condition() const { return (!brk++ && i != e); } }; template <typename T> inline T *qForeachPointer(const T &) { return 0; } template <typename T> inline QForeachContainer<T> qForeachContainerNew(const T& t) { return QForeachContainer<T>(t); } template <typename T> inline const QForeachContainer<T> *qForeachContainer(const QForeachContainerBase *base, const T *) { return static_cast<const QForeachContainer<T> *>(base); } #define Q_FOREACH(variable, container) \ for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \ qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->condition(); \ ++qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i) \ for (variable = *qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i; \ qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk; \ --qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk) Maybe this macro is not perfect or the usage is wrong. I assume that when we replace the macro by hand written for-each code the bug is fixed. Peter