Comment 99 for bug 151162

Revision history for this message
In , Karlt (karlt) wrote :

(From update of attachment 411924)
(In reply to comment #68)
> This patch should fix all mentioned issues. Only the 'check that all data are
> flushed' confused me... doesn't Close() flush the stream automatically before
> it closes?

Yes, it tries to, but that may not succeed. Check the return value of
outputStream->Close() to see whether it succeeded.

>+ // (http://bugreports.qt.nokia.com/browse/QTBUG-5441)

Thanks for filing that. That looks like a sensible suggestion (from my
limited understanding of the Qt APIs).

>+ tmpDir->CreateUnique(nsIFile::DIRECTORY_TYPE, 0700);

I think there should be a check for success here before adding to
mTemporaryFiles to be deleted.

The directory is created here, but this function can still fail to set
mTempFileUri (after cancelling the timer) ...

>+ if (!mTempFileUrl.IsEmpty()) {
>+ // start time to remove temporary files
>+ mTempFileTimer->InitWithCallback(static_cast<nsITimerCallback*>(this),
>+ NS_DND_TIMEOUT,
>+ nsITimer::TYPE_ONE_SHOT);

so I think this should check mTemporaryFiles.Count() instead of mTempFileUrl.

>+ // check whether transferable contains FilePromiseUrl flavor...
>+ PRBool foundFilePromiseFlavor = PR_FALSE;
>+ PRUint32 i;
>+ for (i = 0; i < numDragItems; i++) {

No need for a loop here as numDragItems == 1.