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

List:       kde-commits
Subject:    kdelibs/kio/kio
From:       Michael Brade <brade () kde ! org>
Date:       2005-03-25 0:31:11
Message-ID: 20050325003111.BDA383EC () office ! kde ! org
[Download RAW message or body]

CVS commit by brade: 

A few more steps on the road towards perfection: Finally fixed the crashes due
to redirections in KDirListerCache---one of the most complex bugs. How could we
(well, mostly I ;) have ever been so naiive to think redirections were
trivial...

So the short version: slotRedirection() didn't handle finished listings.

Long version: ListerA holds e.g. lan://localhost. The job finished with an
error, so the item is not set to be complete. ListerA starts to list lan:/ 
again, lan://localhost/ is discarded (since not complete), and a new job is
started. There is an entry "lan:/" in urlsCurrentlyListed and itemsInUse.

At that moment ListerB comes along requesting lan:/ as well. It gets connected
to the running job. Immediately afterwards listerA is stopped (even before the
job was able to redirect to lan://localhost/). This moves lan:/ to
urlsCurrentlyHeld (problem starts!). listerA now holds lan:/.

Then the job redirects to lan://localhost/, but only the lan:/ in
urlsCurrentlyListed is redirected to lan://localhost/, the item in itemsInUse
is renamed. (the item cannot be in itemsCached because only completed items are
moved there) The job then finishes with an error.

So now there is lan://localhost in itemsInUse (with 2 KDirWatch references!)
and in urlsCurrentlyHeld. But there is also a lan:/ in urlsCurrentlyHeld (with
no corresponding entry in itemsInUse, violating one of KDirListerCache's
invariants).

Finally, listerA requests lan:/ again with reload=true. listerA's dirs are
discarded, but when looking for lan:/ in itemsInUse we get a NULL which is
dereferenced later -> KABOOM.

As if that wasn't enough, this "little" bug causes some other effects as well:
when urlA gets redirected to urlB, the urlA is not in itemsInUse or itemsCached
anymore. Subsequent listings of urlA then result in multiple entries in
itemsInUse/itemsCached and urlsCurrentlyHeld. No idea about the exact
consequences of that.

All fixed, together with my previous commits this should fix all known
KDirLister(Cache) crashes.


  M +202 -14   kdirlister.cpp   1.192
  M +1 -1      kdirlister_p.h   1.37



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

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