terrible bug (feature?) in KdialogBase
Waldo Bastian
bastian at kde.org
Tue Apr 1 15:30:20 BST 2003
Ugh, that's nasty. Does the attached patch help?
Cheers,
Waldo
On Tuesday 01 April 2003 16:02, Joerg Anders wrote:
> Hi all!
>
> There seems to be a terrible bug (or is it a feature ?) in KdialogBase
> in KDE-3.1.1. This crahes all my programs. (And I'm convinced
> many others, too)
>
> Have a look at:
>
> http://rnvs.informatik.tu-chemnitz.de/kdialogtest/kdialogtest.html
>
> There you find a short test program and a Makefile. The central code is:
>
>
> class MyDialogBase : public KDialogBase {
> public:
> MyDialogBase(QWidget *parent, char *name) :
> KDialogBase(Tabbed, ...) {
> addHBoxPage(QString("hbox1"), QString::null);
> addHBoxPage(QString("hbox2"), QString::null);
> addHBoxPage(QString("hbox2"), QString::null);
> addHBoxPage(QString("hbox3"), QString::null);
> addHBoxPage(QString("hbox5"), QString::null);
> showPage(0);
> setGeometry(10, 10, 200, 200);
> }
>
> private slots:
> void slotOk() {
> printf("activePageIndex() = %d\n", activePageIndex());
> hide();
> }
> };
>
> If you click the first empty dialog one instance of the widget above
> appears:
>
> virtual void mousePressEvent ( QMouseEvent * e ) {
> MyDialogBase mydialogbase(this, "alpha");
> mydialogbase.exec();
> }
>
> Note! I create a new instance with every new mouse click!
>
> If you press "OK" the "slotOk()" is activated. A series of mouse clicks
> gives:
>
> activePageIndex() = 0
> activePageIndex() = 5
> activePageIndex() = 10
> activePageIndex() = 15
> activePageIndex() = 20
>
> Thus, every new instance of KDialogBase increases the start index.
> Thus, all programs of this kind will crash:
>
> QList<someType> myList;
> myList.append(someObj);
> myList.append(someObj);
> myList.append(someObj);
> myList.append(someObj);
> myList.append(someObj);
>
> ...
> myList.at(activePageIndex());
--
bastian at kde.org -=|[ SuSE, The Linux Desktop Experts ]|=- bastian at suse.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kjanuswidget.patch
Type: text/x-diff
Size: 2035 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030401/df83185c/attachment.patch>
More information about the kde-core-devel
mailing list