Bug 43208 - kde standard application endless loop on File/Quit
Summary: kde standard application endless loop on File/Quit
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: kdevelop 2.x (obsolete) (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KDevelop-Devel List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-29 09:48 UTC by Eggert Ehmke
Modified: 2002-09-22 15:21 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eggert Ehmke 2002-05-29 09:44:05 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kdevelop
Version:           KDE 3.0.1 
Severity:          normal
Installed from:    SuSE RPMs
Compiler:          Not Specified
OS:                Linux
OS/Compiler notes: Not Specified

A kde normal application is generated. The function slotFileQuit in the <project>App class contains these statements:

for(w=memberList->first(); w!=0; w=memberList->first())
   if (!w-close())
...

This is an endless loop. Obviously the close function does not make the next window the first one as the comment some lines before suggests.

(Submitted via bugs.kde.org)
Comment 1 Scott Zuk 2002-06-12 09:29:34 UTC
As stated in the original bug report kdevelop templates generate=20
a broken slotFileQuit() function in the <project>App class.  The=20
for loop doesn't iterate over memberList but instead gets stuck on
the first item.  Below is how the fixed for loop should iterate=20
(based on example in /usr/share/doc/qt3-doc/qptrlist.html).


~Scott

---------------------------------------------------------------------------=
----
void KwaveviewApp::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 clo=
sing
  KMainWindow* w;
  if(memberList)
  {
    /* FIXED!  FOR LOOP CHANGED FROM TEMPLATE BECAUSE PROGRAM WASN'T EXITIN=
G PROPERLY */
    //for(w=3DmemberList->first(); w!=3D0; w=3DmemberList->first())  // <=
=3D Programs don't quit with these conditions because the loop gets stuck o=
n the first list item
    for(w=3DmemberList->first(); w; w=3DmemberList->next())
    {
      // only close the window if the closeEvent is accepted. If the user p=
resses Cancel on the saveModified() dialog
      // the window and the application stay open.
      if(!w->close())
        break;
    }
  }
}
Comment 2 Harald Fernengel 2002-09-22 15:21:20 UTC
Fixed in gideon