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

List:       kde-bugs-dist
Subject:    [Bug 158377] digikam duplicates downloaded images while overwriting
From:       David Fraser <davidf () sjsoft ! com>
Date:       2008-03-03 15:05:58
Message-ID: 20080303150558.21777.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=158377         




------- Additional Comments From davidf sjsoft com  2008-03-03 16:05 -------
I think I have traced what the problem is, by inspecting the source code.
The actual sequence (the important parts):
 A) Download to temporary file (ALWAYS WITH THE SAME NAME, based on the pid)
 B) send event saying download complete
 C) When event is received, rename temporary file to destination name

A) and B) take place in the CameraThread::run method. C) is handled in the \
CameraController::customEvent method.

Since these happen in separate threads, if the event handler ever gets behind the \
downloader, what will happen is:  img1 step A) Download to temporary file
 img1 step B) Send event
 img2 step A) Download to temporary file (OVERWRITING img1 in the temporary file
 img2 step B) Send event
 img1 step C) Rename temporary file to dest/img1, CONTAINING img2!!!
 img2 step C) Try rename temporary file to dest/img2, FAILING, since temporary file \
is missing

The reason that I am sure that this is the problem, is that we know that a \
GPItemInfo::DownloadFailed must have been issued for img2, since the icon shows as a \
cross. Of the places emitting this signal, one is when the \
CameraEvent::gp_downloadFailed is issued. But this creates a dialog (as Gilles said), \
and no dialog is displayed. The other is if the file renaming fails (which it will if \
the temporary file has disappeared). In this case, no dialog is displayed - the \
signal is simply sent.

Simplest fix would be to generate a unique temporary file name for each file. Patch \
to follow...


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

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