From 4f285bd583bf94abf700b31874638f4c838dae22 Mon Sep 17 00:00:00 2001 From: Ting-Yu Chou Date: Wed, 14 Dec 2016 16:34:12 +0800 Subject: [PATCH] Bug 1322458 - Fix kungFuDeathGrip errors that clang plugin reports on Windows. r=aklotz,Ehsan MozReview-Commit-ID: FLTLZSg2yh9 --HG-- extra : rebase_source : e8aad8f35cffb3312e043a4fcec6296371baf432 --- gfx/layers/d3d9/CompositorD3D9.cpp | 1 + ipc/mscom/EnsureMTA.h | 2 ++ ipc/mscom/WeakRef.cpp | 2 +- widget/windows/TSFTextStore.cpp | 20 ++++++++++---------- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/gfx/layers/d3d9/CompositorD3D9.cpp b/gfx/layers/d3d9/CompositorD3D9.cpp index 0f7e942c18ff..cf38bae12c8b 100644 --- a/gfx/layers/d3d9/CompositorD3D9.cpp +++ b/gfx/layers/d3d9/CompositorD3D9.cpp @@ -215,6 +215,7 @@ CompositorD3D9::SetRenderTarget(CompositingRenderTarget *aRenderTarget) { MOZ_ASSERT(aRenderTarget && mDeviceManager); RefPtr oldRT = mCurrentRT; + Unused << oldRT; mCurrentRT = static_cast(aRenderTarget); mCurrentRT->BindRenderTarget(device()); PrepareViewport(mCurrentRT->GetSize()); diff --git a/ipc/mscom/EnsureMTA.h b/ipc/mscom/EnsureMTA.h index d5ae2a7a5a04..4cf667038747 100644 --- a/ipc/mscom/EnsureMTA.h +++ b/ipc/mscom/EnsureMTA.h @@ -10,6 +10,7 @@ #include "MainThreadUtils.h" #include "mozilla/Attributes.h" #include "mozilla/DebugOnly.h" +#include "mozilla/Unused.h" #include "mozilla/mscom/COMApartmentRegion.h" #include "mozilla/mscom/Utils.h" #include "nsCOMPtr.h" @@ -33,6 +34,7 @@ public: MOZ_ASSERT(NS_IsMainThread()); nsCOMPtr thread = GetMTAThread(); MOZ_ASSERT(thread); + Unused << thread; } template diff --git a/ipc/mscom/WeakRef.cpp b/ipc/mscom/WeakRef.cpp index e44027059d7b..26fd0810feb4 100644 --- a/ipc/mscom/WeakRef.cpp +++ b/ipc/mscom/WeakRef.cpp @@ -40,7 +40,7 @@ WeakReferenceSupport::QueryInterface(REFIID riid, void** ppv) *ppv = nullptr; // Raise the refcount for stabilization purposes during aggregation - RefPtr kungFuDeathGrip(static_cast(this)); + RefPtr kungFuDeathGrip(this); if (riid == IID_IUnknown || riid == IID_IWeakReferenceSource) { punk = static_cast(this); diff --git a/widget/windows/TSFTextStore.cpp b/widget/windows/TSFTextStore.cpp index 2b3ed2a43fd9..ebcfea9d8170 100644 --- a/widget/windows/TSFTextStore.cpp +++ b/widget/windows/TSFTextStore.cpp @@ -1719,7 +1719,7 @@ TSFTextStore::FlushPendingActions() return; } - RefPtr kungFuDeathGrip(mWidget); + RefPtr widget(mWidget); nsresult rv = mDispatcher->BeginNativeInputTransaction(); if (NS_WARN_IF(NS_FAILED(rv))) { MOZ_LOG(sTextStoreLog, LogLevel::Error, @@ -1748,8 +1748,8 @@ TSFTextStore::FlushPendingActions() if (action.mAdjustSelection) { // Select composition range so the new composition replaces the range - WidgetSelectionEvent selectionSet(true, eSetSelection, mWidget); - mWidget->InitEvent(selectionSet); + WidgetSelectionEvent selectionSet(true, eSetSelection, widget); + widget->InitEvent(selectionSet); selectionSet.mOffset = static_cast(action.mSelectionStart); selectionSet.mLength = static_cast(action.mSelectionLength); selectionSet.mReversed = false; @@ -1770,7 +1770,7 @@ TSFTextStore::FlushPendingActions() MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("0x%p TSFTextStore::FlushPendingActions() " "dispatching compositionstart event...", this)); - WidgetEventTime eventTime = mWidget->CurrentMessageWidgetEventTime(); + WidgetEventTime eventTime = widget->CurrentMessageWidgetEventTime(); nsEventStatus status; rv = mDispatcher->StartComposition(status, &eventTime); if (NS_WARN_IF(NS_FAILED(rv))) { @@ -1781,7 +1781,7 @@ TSFTextStore::FlushPendingActions() this, GetBoolName(!IsComposingInContent()))); mDeferClearingContentForTSF = !IsComposingInContent(); } - if (!mWidget || mWidget->Destroyed()) { + if (!widget || widget->Destroyed()) { break; } break; @@ -1814,7 +1814,7 @@ TSFTextStore::FlushPendingActions() MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("0x%p TSFTextStore::FlushPendingActions() " "dispatching compositionchange event...", this)); - WidgetEventTime eventTime = mWidget->CurrentMessageWidgetEventTime(); + WidgetEventTime eventTime = widget->CurrentMessageWidgetEventTime(); nsEventStatus status; rv = mDispatcher->FlushPendingComposition(status, &eventTime); if (NS_WARN_IF(NS_FAILED(rv))) { @@ -1844,7 +1844,7 @@ TSFTextStore::FlushPendingActions() MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("0x%p TSFTextStore::FlushPendingActions(), " "dispatching compositioncommit event...", this)); - WidgetEventTime eventTime = mWidget->CurrentMessageWidgetEventTime(); + WidgetEventTime eventTime = widget->CurrentMessageWidgetEventTime(); nsEventStatus status; rv = mDispatcher->CommitComposition(status, &action.mData, &eventTime); if (NS_WARN_IF(NS_FAILED(rv))) { @@ -1875,8 +1875,8 @@ TSFTextStore::FlushPendingActions() break; } - WidgetSelectionEvent selectionSet(true, eSetSelection, mWidget); - selectionSet.mOffset = + WidgetSelectionEvent selectionSet(true, eSetSelection, widget); + selectionSet.mOffset = static_cast(action.mSelectionStart); selectionSet.mLength = static_cast(action.mSelectionLength); @@ -1887,7 +1887,7 @@ TSFTextStore::FlushPendingActions() MOZ_CRASH("unexpected action type"); } - if (mWidget && !mWidget->Destroyed()) { + if (widget && !widget->Destroyed()) { continue; }