Race condition with data loss in ReadWritePart

Ingo Klöcker kloecker at kde.org
Sun Feb 24 12:18:17 GMT 2008

On Saturday 23 February 2008, Martin Pley wrote:
> > I noticed a race condition with data loss in ReadWritePart:
> >
> > Try to open a non-local-file from a slow or offline server. Then,
> > instead of waiting for the file, just open another local file. Now,
> > when you delete the part, the file is deleted(!).
> >
> > If I see it correctly, this is because m_bTemp is set to "true"
> > while opening the remote file. And when you open the local file it
> > will not be set to false again.
> It's actually not a race condition. I reimplemented
> ReadWritePart::closeURL() without setting m_bTemp to false. And when
> I delete the part, ~ReadOnlyPart calls ReadOnlyPart::closeURL(),
> which deletes the file.
> Perhaps one should add a warning to the documentation of closeURL().

There's no need for adding a warning. We just need to call closeURL() 
from ~ReadWritePart.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080224/5ec92ed3/attachment.sig>

More information about the kde-core-devel mailing list