Bug in KDE MDI Template?

James Thorniley james.thorniley at ntlworld.com
Mon Jun 3 01:35:04 UTC 2002


Hi,

I noticed talk on this list about a 2.1.2 release and I just really felt I 
needed to mention this seemingly major issue (I'm not sure *how* major it is, 
the fact that as far as I can see, this has been in KDevelop for *ages* and 
not apparently caused anyone to do anything about it makes me feel there's 
something wrong with me ;) I realise KDE 2.1.2 is a bugfix release and if I 
am right then this is quite a serious bug.

Noticed the following in skel/kbase.cpp, line 403 from 
kdevelop/templates/kdemdi.tar.gz in KDevelop 2.1.1 for KDE 3 source:

void |NAME|App::slotFileQuit()
{
  ..blah blah..

  KMainWindow* w;
  if(memberList)
  {
    for(w=memberList->first(); w!=0; w=memberList->first())
    {
      // 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;
    }
  }
  slotStatusMsg(i18n("Ready."));
}

I'm not sure about the line:

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

This seems to be saying, if w is not null, [try and close w], then set w to be 
the first window in the list. Thus sending the application in a continuous 
loop when you try and quit (this is what happened in my experience, anyway), 
my fix was..

  for(w=memberList->first(); w!=0; w=memberList->next())
                                                 ^^^^

It's quite possible I'm being very dumb here; for some reason this problem 
does not seem to manifest itself in KDE 2, I noticed it while porting an app 
to KDE 3, where indeed it causes a loop.

It seems pointless to try and make a diff for something that's inside a tar 
and is such a trivial change, so I'm afraid I won't bother ;)

Regards
James Thorniley






More information about the KDevelop-devel mailing list