[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdevelop
Subject:    Again: Bugs in KDE Normal/MDI and Qt templates
From:       "Pascal A. Niklaus" <Pascal.Niklaus () unibas ! ch>
Date:       2001-07-20 3:31:46
[Download RAW message or body]

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

[Attachment #3 (text/html)]

<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>
&nbsp; slotStatusMsg(i18n(&quot;Exiting...&quot;));<br>
&nbsp; saveOptions();<br>
&nbsp; // close the first window, the list makes the next one the first
again.<br>
&nbsp; // This ensures that queryClose() is called on each window to ask
for closing<br>
&nbsp; KMainWindow* w;<br>
&nbsp; if(memberList)<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; for(w=memberList-&gt;first(); w!=0;
w=memberList-&gt;first())<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // only close the window if the closeEvent
is accepted. <br>
&nbsp; <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp; // the
user presses Cancel on the saveModified() dialog,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // the window and the application stay
open.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!w-&gt;close())<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;<x-tab>&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
 //&lt;== what happens to statusBar etc. if only part of the windows are
closed?<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp; }<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><br>
&nbsp; slotStatusMsg(i18n(&quot;Ready.&quot;));&nbsp;&nbsp; // &lt;===
CAUSES CRASH if no statusBar is left...<br>
}<br>
<br>
<br>
<br>
</tt><blockquote type=cite cite>&quot;Pascal A. Niklaus&quot; 
wrote:<br>
&gt; <br>
&gt; At 06:58 PM 16/07/2001, you wrote:<br>
&gt; <br>
&gt; &gt;&quot;Pascal A. Niklaus&quot; wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; There were two more bugs in the project templates of
KDevelop 1.4.1:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; - QT Application:&nbsp; The user application object is
never destroyed, which is<br>
&gt; &gt; &gt; a nuisance if there is important cleanup code in the
destructor...<br>
&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The
following fix will do it...<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
QApplication a(argc, argv);<br>
&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
a.setFont(QFont(&quot;helvetica&quot;, 12));<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QSomeApp
*qsomeapp=new QSomeApp();<br>
&gt; &gt;<br>
&gt; &gt;Just not using new&nbsp; here will save the additional delete
line :)<br>
&gt; &gt;I will have a look today and fix this.<br>
&gt; <br>
&gt; Yes, but it is not nice to have a potentially large object on the
stack....<br>
&gt; 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>


-
to unsubscribe from this list send an email to kdevelop-request@kdevelop.org with the following body:
unsubscribe »your-email-address«


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic