Using uic generated classes as a base class in public API
Matt Rogers
mattr at kde.org
Wed Mar 2 17:33:03 UTC 2005
Hi,
It's a huge mistake to use classes generated by uic in public API. The reason
for this is that uic generated classes lack virtual destructors. Without
virtual destructors, derived class destructors are never called, and then
leak memory, objects don't get deleted properly, in essence, you're screwed.
Since, AFAIK, the kdevelop project as a whole doesn't care about BC, we need
to fix the classes that use a uic generated class as a base class. I first
noticed the problem in languages/lib/designer_integration but i imagine it's
elsewhere too.
Here's how we fix it:
- Change the classes that have a uic generated class as a base class to store
a pointer to the uic generated class instead.
- Make the base class derive from the appropriate widget.
- Convert any uic generated class that's not a QWidget (i.e. QDialog or
similar, to QWidget) to a QWidget
I'll leave languages/lib/designer_integration to adymo, but will try to go
through kdevelop and change the other relevant classes throughout the week.
Matt
More information about the KDevelop-devel
mailing list