Commit b4461e4e authored by Masatoshi Kimura's avatar Masatoshi Kimura
Browse files

Bug 1636740 - Block CMemStream::Read only if the drop target initiated an...

Bug 1636740 - Block CMemStream::Read only if the drop target initiated an async operation. r=aklotz, a=pascalc

If the drop target did not initiate an async operation, `DoDragDrop` will
block on the main thread until the data transfer completes. Although the
`ObtainCachedIconFile` callback itself will run off the main thread,
`ObtainCachedIconFile` will end up with calling `NotifyIconObservers` that
heavily relies on the main thread. So `ObtainCachedIconFile` will have no
chance to run the callback.

To complete the data transfer, however, the `ObtainCachedIconFile` callback
must signal the event object to unblock `CMemStream::Read`. Deadlock.

Differential Revision: https://phabricator.services.mozilla.com/D75531
parent 8bcf2a9b
...@@ -1360,6 +1360,11 @@ nsDataObj ::GetFileContentsInternetShortcut(FORMATETC& aFE, STGMEDIUM& aSTG) { ...@@ -1360,6 +1360,11 @@ nsDataObj ::GetFileContentsInternetShortcut(FORMATETC& aFE, STGMEDIUM& aSTG) {
::GlobalUnlock(globalMem.get()); ::GlobalUnlock(globalMem.get());
if (aFE.tymed & TYMED_ISTREAM) { if (aFE.tymed & TYMED_ISTREAM) {
if (!mIsInOperation) {
// The drop target didn't initiate an async operation.
// We can't block CMemStream::Read.
event = nullptr;
}
RefPtr<IStream> stream = RefPtr<IStream> stream =
new CMemStream(globalMem.disown(), totalLen, event.forget()); new CMemStream(globalMem.disown(), totalLen, event.forget());
stream.forget(&aSTG.pstm); stream.forget(&aSTG.pstm);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment