Qt-interest Archive, December 2006
Don't make a class called Connection!
Message 1 in thread
I just spent the best part of a day trying to figure out why
QWidgetFactory::create had suddenly started to cause crashes in my
application. It was crashing in QWidgetFactory::loadConnections on the line:
conn.signal = n2.firstChild().toText().data();
A simple assignment from a QString to a QCString.
I then remembered I had recently defined a class called Connection and that
there was a struct defined in qwidgetfactory.cpp also called Connection.
I still don't know how the Qt DLL got mixed up between its locally defined
Connection class and mine. But renaming my class fixed the problem.
Maybe Qt should publish a list of all the hidden classes in their library, so
that we can avoid name clashes in the future.
Using Qt 3.3.7 on WinXP.
Andy.
--
[ signature omitted ]
Message 2 in thread
You might also encapsulate your classes in a namespace to avoid compiler
confusion.
Pepsiman
-----Original Message-----
From: Andrew Ward [mailto:andy.ward@xxxxxxxxxx]
Sent: Tuesday, December 05, 2006 2:54 PM
To: qt-interest@xxxxxxxxxxxxx
Subject: Don't make a class called Connection!
I just spent the best part of a day trying to figure out why
QWidgetFactory::create had suddenly started to cause crashes in my
application. It was crashing in QWidgetFactory::loadConnections on the line:
conn.signal = n2.firstChild().toText().data();
A simple assignment from a QString to a QCString.
I then remembered I had recently defined a class called Connection and that
there was a struct defined in qwidgetfactory.cpp also called Connection.
I still don't know how the Qt DLL got mixed up between its locally defined
Connection class and mine. But renaming my class fixed the problem.
Maybe Qt should publish a list of all the hidden classes in their library,
so
that we can avoid name clashes in the future.
Using Qt 3.3.7 on WinXP.
Andy.
--
[ signature omitted ]
Message 3 in thread
True, that would solve the problem. But the problem should not have occurred
in the first place. It's not like I tried to create a class called
QConnection. I wonder what other hidden classes there are.
Andy.
On Wednesday 06 December 2006 9:56 am, Karl Ruetz wrote:
> You might also encapsulate your classes in a namespace to avoid compiler
> confusion.
>
> Pepsiman
>
> -----Original Message-----
> From: Andrew Ward [mailto:andy.ward@xxxxxxxxxx]
> Sent: Tuesday, December 05, 2006 2:54 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: Don't make a class called Connection!
>
> I just spent the best part of a day trying to figure out why
> QWidgetFactory::create had suddenly started to cause crashes in my
> application. It was crashing in QWidgetFactory::loadConnections on the
> line: conn.signal = n2.firstChild().toText().data();
> A simple assignment from a QString to a QCString.
>
> I then remembered I had recently defined a class called Connection and that
> there was a struct defined in qwidgetfactory.cpp also called Connection.
> I still don't know how the Qt DLL got mixed up between its locally defined
> Connection class and mine. But renaming my class fixed the problem.
>
> Maybe Qt should publish a list of all the hidden classes in their library,
> so
> that we can avoid name clashes in the future.
>
> Using Qt 3.3.7 on WinXP.
> Andy.
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 4 in thread
Hi,
> Maybe Qt should publish a list of all the hidden classes in their library, so
> that we can avoid name clashes in the future.
>
> Using Qt 3.3.7 on WinXP.
I would suggest reporting this issue here so that it doesn't get lost:
http://www.trolltech.com/bugreport-form
--
[ signature omitted ]