Again: Bugs in KDE Normal/MDI and Qt templates
Pascal A. Niklaus
Pascal.Niklaus at unibas.ch
Fri Jul 20 04:31:46 BST 2001
Hi,
Just a few more comments before the 2.2 release... I just realised that
there are also problems with the destruction of documents... The document
objects also are not properly deleted by the application on exit (Qt
application).
I think the destruction code in the Qt and KDE templates needs a careful
re-examination to make sure that
(1) no deleted objects are re-accessed if the app is not quit (see code and
comments below)
(2) all objects are really deleted upon exit.
These things are really terrible for beginners which think the app
framework created by the templates is correct and search for bugs in their
own code if it crashes...
Pascal
void Mdidbg_okApp::slotFileQuit()
{
slotStatusMsg(i18n("Exiting..."));
saveOptions();
// close the first window, the list makes the next one the first again.
// This ensures that queryClose() is called on each window to ask for
closing
KMainWindow* w;
if(memberList)
{
for(w=memberList->first(); w!=0; w=memberList->first())
{
// only close the window if the closeEvent is accepted.
// the user presses Cancel on the saveModified() dialog,
// the window and the application stay open.
if(!w->close())
break; //<== what happens to statusBar
etc. if only part of the windows are closed?
}
}
slotStatusMsg(i18n("Ready.")); // <=== CAUSES CRASH if no statusBar is
left...
}
>"Pascal A. Niklaus" wrote:
> >
> > At 06:58 PM 16/07/2001, you wrote:
> >
> > >"Pascal A. Niklaus" wrote:
> > > >
> > > > There were two more bugs in the project templates of KDevelop 1.4.1:
> > > >
> > > > - QT Application: The user application object is never destroyed,
> which is
> > > > a nuisance if there is important cleanup code in the destructor...
> > > > The following fix will do it...
> > > >
> > > > QApplication a(argc, argv);
> > > > a.setFont(QFont("helvetica", 12));
> > > >
> > > > QSomeApp *qsomeapp=new QSomeApp();
> > >
> > >Just not using new here will save the additional delete line :)
> > >I will have a look today and fix this.
> >
> > Yes, but it is not nice to have a potentially large object on the stack....
> > I'd prefer the new. Maybe it would also pay to put QApplication onto
> the heap?
>Well, I'd like to keep the code for the KDE and Qt templates as
>synchronous as possible, and putting QApplication on the heap is quite
>uncommon :) So in any case I'd like to keep the code as much as it is.
>
>Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20010720/a2a42b22/attachment.html>
More information about the KDevelop
mailing list