Bug#43208: Fix for bug #43208 "kde standard application endless loop on File/Quit"

Scott Zuk szuk at telusplanet.net
Wed Jun 12 11:34:02 UTC 2002


As stated in the original bug report, kdevelop templates generate 
a broken slotFileQuit() function in the <project>App class.  The 
for loop doesn't iterate over memberList but instead gets stuck on
the first item.  Below is how the fixed for loop should iterate 
(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 closing
  KMainWindow* w;
  if(memberList)
  {
    /* FIXED!  FOR LOOP CHANGED FROM TEMPLATE BECAUSE PROGRAM WASN'T EXITING PROPERLY */
    //for(w=memberList->first(); w!=0; w=memberList->first())  // <= Programs don't quit with these conditions because the loop gets stuck on the first list item
    for(w=memberList->first(); w; w=memberList->next())
    {
      // only close the window if the closeEvent is accepted. If the user presses Cancel on the saveModified() dialog,
      // the window and the application stay open.
      if(!w->close())
        break;
    }
  }
}

(Complete bug history is available at http://bugs.kde.org/db/43/43208.html)




More information about the KDevelop-devel mailing list