<html>
Hi,<br>
<br>
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). <br>
<br>
I think the destruction code in the Qt and KDE templates needs a careful
re-examination to make sure that <br>
(1) no deleted objects are re-accessed if the app is not quit (see code
and comments below)<br>
(2) all objects are really deleted upon exit.<br>
<br>
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...<br>
<br>
Pascal<br>
<br>
<tt>void Mdidbg_okApp::slotFileQuit()<br>
{<br>
slotStatusMsg(i18n("Exiting..."));<br>
saveOptions();<br>
// close the first window, the list makes the next one the first
again.<br>
// This ensures that queryClose() is called on each window to ask
for closing<br>
KMainWindow* w;<br>
if(memberList)<br>
{<br>
for(w=memberList->first(); w!=0;
w=memberList->first())<br>
{<br>
// only close the window if the closeEvent
is accepted. <br>
<x-tab> </x-tab> // the
user presses Cancel on the saveModified() dialog,<br>
// the window and the application stay
open.<br>
if(!w->close())<br>
break;<x-tab> </x-tab><x-tab> </x-tab><x-tab> </x-tab><x-tab> </x-tab>
//<== what happens to statusBar etc. if only part of the windows are
closed?<br>
}<br>
}<x-tab> </x-tab><br>
slotStatusMsg(i18n("Ready.")); // <===
CAUSES CRASH if no statusBar is left...<br>
}<br>
<br>
<br>
<br>
</tt><blockquote type=cite cite>"Pascal A. Niklaus"
wrote:<br>
> <br>
> At 06:58 PM 16/07/2001, you wrote:<br>
> <br>
> >"Pascal A. Niklaus" wrote:<br>
> > ><br>
> > > There were two more bugs in the project templates of
KDevelop 1.4.1:<br>
> > ><br>
> > > - QT Application: The user application object is
never destroyed, which is<br>
> > > a nuisance if there is important cleanup code in the
destructor...<br>
> > > The
following fix will do it...<br>
> > ><br>
> > >
QApplication a(argc, argv);<br>
> > >
a.setFont(QFont("helvetica", 12));<br>
> > ><br>
> > > QSomeApp
*qsomeapp=new QSomeApp();<br>
> ><br>
> >Just not using new here will save the additional delete
line :)<br>
> >I will have a look today and fix this.<br>
> <br>
> Yes, but it is not nice to have a potentially large object on the
stack....<br>
> I'd prefer the new. Maybe it would also pay to put QApplication onto
the heap?<br>
Well, I'd like to keep the code for the KDE and Qt templates as<br>
synchronous as possible, and putting QApplication on the heap is
quite<br>
uncommon :) So in any case I'd like to keep the code as much as it
is.<br>
<br>
Ralf</blockquote></html>