QPrint seems to be getting deleted twice. I don't know why. Tried adding
a dtor to QPrint -> same bug

Tried adding a QPrintDialog dtor -> bug goes away.

Here is the bt at dtor time :

(gdb) bt
#0  QPrint::~QPrint (this=0x83aa650, __in_chrg=2) at QPrint.C:41
#1  0x081df1b3 in Dialogs::Impl::~Impl (this=0x83a9698, __in_chrg=3) at 
../../../boost/boost/checked_delete.hpp:27
#2  0x081debb1 in void boost::checked_delete<Dialogs::Impl> (x=0x83a9698) at 
../../../boost/boost/checked_delete.hpp:27
#3  0x081dcf53 in boost::scoped_ptr<Dialogs::Impl>::~scoped_ptr (this=0x83a95bc, 
__in_chrg=2) at ../../../boost/boost/scoped_ptr.hpp:59
#4  0x081dcb6b in Dialogs::~Dialogs (this=0x83a9570, __in_chrg=3) at Dialogs.C:30
#5  0x081d3585 in void boost::checked_delete<Dialogs> (x=0x83a9570) at 
../../boost/boost/checked_delete.hpp:27
#6  0x081d32f3 in boost::scoped_ptr<Dialogs>::~scoped_ptr (this=0xbffff100, 
__in_chrg=2) at ../../boost/boost/scoped_ptr.hpp:59
#7  0x081d2895 in LyXView::~LyXView (this=0xbffff0a8, __in_chrg=0) at LyXView.C:63
#8  0x082060ea in QtView::~QtView (this=0xbffff030, __in_chrg=2) at QtView.C:95

and at crash time :

(gdb) bt
#0  0x40184736 in QGList::first (this=0x160) at tools/qglist.cpp:809
#1  0x4047099f in QList<QButtonItem>::first (this=0x160) at 
/home/moz/src/qt-2.3.1/include/qlist.h:87
#2  0x402899aa in QButtonGroup::~QButtonGroup (this=0x83ef6c0, __in_chrg=3) at 
widgets/qbuttongroup.cpp:175
#3  0x40266e34 in QWidget::~QWidget (this=0x83ee5b0, __in_chrg=0) at 
kernel/qwidget.cpp:791
#4  0x401f4223 in QDialog::~QDialog (this=0x83ee5b0, __in_chrg=0) at 
kernel/qdialog.cpp:163
#5  0x403938f9 in QPrintDialog::~QPrintDialog (this=0x83ee5b0, __in_chrg=3) at 
dialogs/qprintdialog.cpp:737
#6  0x081fda25 in void boost::checked_delete<QPrintDialog> (x=0x83ee5b0) at 
../../../boost/boost/checked_delete.hpp:27
#7  0x081fdf8f in boost::scoped_ptr<QPrintDialog>::~scoped_ptr (this=0x83aa724, 
__in_chrg=2) at ../../../boost/boost/scoped_ptr.hpp:59
#8  0x081fdab3 in Qt2DB<QPrintDialog>::~Qt2DB (this=0x83aa6ec, __in_chrg=0) at 
QPrint.C:37
#9  0x081fdb43 in Qt2CB<ControlPrint, Qt2DB<QPrintDialog> >::~Qt2CB (this=0x83aa6ec, 
__in_chrg=0) at QPrint.C:37
#10 0x081fcf57 in QPrint::~QPrint (this=0x83aa6ec, __in_chrg=2) at QPrint.C:42
#11 0x081e0261 in GUI<ControlPrint, QPrint, OkApplyCancelPolicy, Qt2BC>::~GUI 
(this=0x83aa650, __in_chrg=2) at Dialogs.C:76
#12 0x081df1b3 in Dialogs::Impl::~Impl (this=0x83a9698, __in_chrg=3) at 
../../../boost/boost/checked_delete.hpp:27
#13 0x081debb1 in void boost::checked_delete<Dialogs::Impl> (x=0x83a9698) at 
../../../boost/boost/checked_delete.hpp:27
#14 0x081dcf53 in boost::scoped_ptr<Dialogs::Impl>::~scoped_ptr (this=0x83a95bc, 
__in_chrg=2) at ../../../boost/boost/scoped_ptr.hpp:59
#15 0x081dcb6b in Dialogs::~Dialogs (this=0x83a9570, __in_chrg=3) at Dialogs.C:30
#16 0x081d3585 in void boost::checked_delete<Dialogs> (x=0x83a9570) at 
../../boost/boost/checked_delete.hpp:27
#17 0x081d32f3 in boost::scoped_ptr<Dialogs>::~scoped_ptr (this=0xbffff100, 
__in_chrg=2) at ../../boost/boost/scoped_ptr.hpp:59
#18 0x081d2895 in LyXView::~LyXView (this=0xbffff0a8, __in_chrg=0) at LyXView.C:63
#19 0x082060ea in QtView::~QtView (this=0xbffff030, __in_chrg=2) at QtView.C:95

valgrind :

==5661== Invalid read of size 2
==5661==    at 0x40674877: ??? (kernel/qpaintdevice.h:280)
==5661==    by 0x406A5C65: ??? (/home/moz/src/qt-2.3.1/include/qvaluelist.h:192)
==5661==    by 0x406A5E5F: ??? (/home/moz/src/qt-2.3.1/include/qvaluelist.h:192)
==5661==    by 0x404AEA27: QButtonGroup::~QButtonGroup(void) 
(widgets/qbuttongroup.cpp:182)
==5661==    by 0x4048BE34: QWidget::~QWidget(void) (kernel/qwidget.cpp:791)
==5661==    by 0x40419223: QDialog::~QDialog(void) (kernel/qdialog.cpp:163)
==5661==    by 0x405B88F9: QPrintDialog::~QPrintDialog(void) 
(dialogs/qprintdialog.cpp:737)
==5661==    by 0x81FDA25: ??? (../../../boost/boost/checked_delete.hpp:27)
==5661==    by 0x81FDF8F: ??? (../../../boost/boost/scoped_ptr.hpp:59)
==5661==    by 0x81FDAB3: ??? (QPrint.C:37)
==5661==    by 0x81FDB43: ??? (QPrint.C:37)
==5661==    by 0x81FCF57: QPrint::~QPrint(void) (QPrint.C:42)
==5661==    by 0x81E0261: ??? (Dialogs.C:76)
==5661==    by 0x81DF1B3: ??? (../../../boost/boost/checked_delete.hpp:27)
==5661==    by 0x81DEBB1: ??? (../../../boost/boost/checked_delete.hpp:27)
==5661==    by 0x81DCF53: ??? (../../../boost/boost/scoped_ptr.hpp:59)
==5661==    by 0x81DCB6B: Dialogs::~Dialogs(void) (Dialogs.C:30)
==5661==    by 0x81D3585: ??? (../../boost/boost/checked_delete.hpp:27)
==5661==    by 0x81D32F3: ??? (../../boost/boost/scoped_ptr.hpp:59)
==5661==    by 0x81D2895: LyXView::~LyXView(void) (LyXView.C:63)
==5661==    by 0x82060EA: QtView::~QtView(void) (QtView.C:95)
==5661==    by 0x81E145D: lyx_gui::start(basic_string<char, string_char_traits<char>, 
__default_alloc_template<true, 0> > const &, vector<basic_string<char, 
string_char_traits<char>, __default_alloc_template<true, 0> >, 
allocator<basic_string<char, string_char_traits<char>, __default_alloc_template<true, 
0> > > >) (lyx_gui.C:123)
==5661==    by 0x80DD0DA: LyX::LyX(int &, char **) (../src/lyx_main.C:159)
==5661==    by 0x810899B: main (../src/main.C:31)
==5661==    by 0x40924B5C: __libc_start_main (../sysdeps/generic/libc-start.c:129)
==5661==    by 0x805E571: QMainWindow::childEvent(QChildEvent *) (in 
/home/moz/src/lyx/lyx-qt2/src/lyx)
==5661==    Address 0x44DC0B16 is 42 bytes inside a block of size 204 free'd
==5661==    at 0x40045AF9: __builtin_delete (vg_clientfuncs.c:186)
==5661==    by 0x405B88E9: QPrintDialog::~QPrintDialog(void) 
(dialogs/qprintdialog.cpp:736)
==5661==    by 0x81FDA25: ??? (../../../boost/boost/checked_delete.hpp:27)
==5661==    by 0x81FDF8F: ??? (../../../boost/boost/scoped_ptr.hpp:59)
==5661==    by 0x81FDAB3: ??? (QPrint.C:37)
==5661==    by 0x81FDB43: ??? (QPrint.C:37)
==5661==    by 0x81FCF57: QPrint::~QPrint(void) (QPrint.C:42)
==5661==    by 0x81E0261: ??? (Dialogs.C:76)
==5661==    by 0x81DF1B3: ??? (../../../boost/boost/checked_delete.hpp:27)
==5661==    by 0x81DEBB1: ??? (../../../boost/boost/checked_delete.hpp:27)
==5661==    by 0x81DCF53: ??? (../../../boost/boost/scoped_ptr.hpp:59)
==5661==    by 0x81DCB6B: Dialogs::~Dialogs(void) (Dialogs.C:30)
==5661==    by 0x81D3585: ??? (../../boost/boost/checked_delete.hpp:27)
==5661==    by 0x81D32F3: ??? (../../boost/boost/scoped_ptr.hpp:59)
==5661==    by 0x81D2895: LyXView::~LyXView(void) (LyXView.C:63)
==5661==    by 0x82060EA: QtView::~QtView(void) (QtView.C:95)
==5661==    by 0x81E145D: lyx_gui::start(basic_string<char, string_char_traits<char>, 
__default_alloc_template<true, 0> > const &, vector<basic_string<char, 
string_char_traits<char>, __default_alloc_template<true, 0> >, 
allocator<basic_string<char, string_char_traits<char>, __default_alloc_template<true, 
0> > > >) (lyx_gui.C:123)
==5661==    by 0x80DD0DA: LyX::LyX(int &, char **) (../src/lyx_main.C:159)
==5661==    by 0x810899B: main (../src/main.C:31)
==5661==    by 0x40924B5C: __libc_start_main (../sysdeps/generic/libc-start.c:129)
==5661==    by 0x805E571: QMainWindow::childEvent(QChildEvent *) (in 
/home/moz/src/lyx/lyx-qt2/src/lyx
-- 
"Take the ideas you find useful. Try not to get hung up on the labels."
        - Jonathan S. Shapiro

Reply via email to