Again: Bugs in KDE Normal/MDI and Qt templates
Ralf Nolden
nolden at kde.org
Fri Jul 20 07:21:10 BST 2001
On Friday, 20. July 2001 05:31, you wrote:
Hi Pascal,
could you fix the templates' code and mail me the tarballs ? Then I just
commit them; I'm currently learning for my exams so I have absolutely no more
time to look into this for longer than half an hour. You would do me a great
favour.
Thanks,
Ralf
> 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
--
--
We're not a company, we just produce better code at less costs.
--------------------------------------------------------------------
Ralf Nolden
nolden at kde.org
The K Desktop Environment The KDevelop Project
http://www.kde.org http://www.kdevelop.org
-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«
More information about the KDevelop
mailing list