[prev in list] [next in list] [prev in thread] [next in thread]
List: kopete-devel
Subject: Re: [Kopete-devel] KJanusWidget problem (also with noatun/kopete): showstopper?
From: Martijn Klingens <klingens () kde ! org>
Date: 2002-11-08 16:54:34
[Download RAW message or body]
On Friday 08 November 2002 17:10, Ravikiran Rajagopal wrote:
>----- #include <kapplication.h>
> #include <kjanuswidget.h>
> #include <qhbox.h>
> #include <qstringlist.h>
> #include <qtextedit.h>
>
> int main( int argc, char **argv )
> {
> KApplication app( argc, argv, "Testing" );
>
> KJanusWidget wid(0,0,KJanusWidget::TreeList);
What happens if you make this
KJanusWidget *wid = new KJanusWidget(0,0,KJanusWidget::TreeList);
and change '&wid' into 'wid' resp. 'wid.' into 'wid->' accordingly?
> app.setMainWidget( &wid );
>
> QStringList list1, list2;
> list1 << "level1" << "page";
> list2 << "level2" << "page";
> QHBox *box1, *box2;
> box1 = wid.addHBoxPage(list1);
> new QTextEdit(box1);
> box2 = wid.addHBoxPage(list2);
> new QTextEdit(box2);
>
> wid.show();
> delete box1;
>
> return app.exec();
> }
> ---------------------------------------------------------------------------
Also, what does valgrind output?
My suspicion is that the main widget is deleted twice here, although looking
at my (rather old) qt-copy checkout I can't see this confirmed.
Another option is that deleting wid on shutdown goes wrong for objects on the
stack. If you make wid a pointer and delete it, does that make a difference
with 'leaking' the object by not deleting?
If you make the KApp a pointer instead, does it make a difference if you
delete the app before or after the widget? In your example I wonder in what
order both on-stack objects are deleted by the compiler. FIFO or LIFO ?
--
Martijn
_______________________________________________
Kopete-devel mailing list
Kopete-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kopete-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic