Revision 75da8e8...

Go back to digest for 2nd December 2012

Bug Fixes in KDE Base

David Faure committed changes in [kdelibs/KDE/4.9] /:

Fix KDirLister forgetting to watch a directory after listing it from the cache.

Many many thanks to Frank Reininghaus for the unittest that finally made
this issue reproduceable, based on feedback from users in the bug report.

The issue: whether to watch a directory with KDirWatch is refcounted.
Each lister showing the dir counts as one, the cache itself can add one,
and does so initially. If a dir is modified while it's only in the cache,
we mark it as dirty, stop watching, and we'll simply update the directory
when showing it to the user again later. At that point we need to start
watching it again. The old code would do decr+incr, I "optimized" this in
7b9cafaaf6af (oct 2010) to fix the bug that (with an initial refcount of 1),
decr would lead to 0 temporarily.
However if the item wasn't watched anymore (initial refcount of 0), the decr
would do nothing (if (c<0) c=0), and the incr would start the watching.
With 7b9cafaaf6af this all went away (I thought decr+incr==noop), so no watching.
The proper solution is obviously incr+decr_if_not_done_before_already
(when the cache stops watching the dir because a change happened).

FIXED-IN: 4.9.4

File Changes

Modified 4 files
  •   kio/kio/kdirlister.cpp
  •   kio/kio/kdirlister_p.h
  •   kio/tests/kdirlistertest.cpp
  •   kio/tests/kdirlistertest.h
4 files changed in total