From 9bb98f6586ccb2eb377aa609ae5e047709c935b7 Mon Sep 17 00:00:00 2001 From: "caillon%returnzero.com" Date: Tue, 18 Nov 2003 20:54:29 +0000 Subject: [PATCH] 226059 nsITransferable* nsClipboard::GetTransferable() returns an addrefed raw pointer r=timeless sr=blizzard git-svn-id: svn://10.0.0.236/trunk@149505 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/gtk/nsClipboard.cpp | 9 ++++----- mozilla/widget/src/gtk2/nsClipboard.cpp | 4 +--- mozilla/widget/src/photon/nsClipboard.cpp | 7 +++---- mozilla/widget/src/xlib/nsClipboard.cpp | 3 +-- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/mozilla/widget/src/gtk/nsClipboard.cpp b/mozilla/widget/src/gtk/nsClipboard.cpp index 2f47ea603e2..16a05c89093 100644 --- a/mozilla/widget/src/gtk/nsClipboard.cpp +++ b/mozilla/widget/src/gtk/nsClipboard.cpp @@ -303,7 +303,7 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard) GdkAtom selectionAtom = GetSelectionAtom(aWhichClipboard); - nsCOMPtr transferable(getter_AddRefs(GetTransferable(aWhichClipboard))); + nsCOMPtr transferable(GetTransferable(aWhichClipboard)); // make sure we have a good transferable if (nsnull == transferable) { @@ -744,7 +744,7 @@ NS_IMETHODIMP nsClipboard::ForceDataToClipboard(PRInt32 aWhichClipboard) // make sure we have a good transferable - nsCOMPtr transferable(getter_AddRefs(GetTransferable(aWhichClipboard))); + nsCOMPtr transferable(GetTransferable(aWhichClipboard)); if (nsnull == transferable) { return NS_ERROR_FAILURE; @@ -866,7 +866,7 @@ void nsClipboard::SelectionGetCB(GtkWidget *widget, #ifdef DEBUG_CLIPBOARD g_print(" whichClipboard = %d\n", whichClipboard); #endif - nsCOMPtr transferable(getter_AddRefs(cb->GetTransferable(whichClipboard))); + nsCOMPtr transferable(cb->GetTransferable(whichClipboard)); // Make sure we have a transferable: if (!transferable) { @@ -1161,7 +1161,6 @@ nsITransferable *nsClipboard::GetTransferable(PRInt32 aWhichClipboard) transferable = mSelectionTransferable; break; } - NS_IF_ADDREF(transferable); return transferable; } @@ -1269,7 +1268,7 @@ void nsClipboard::SetCutBuffer() PRUint32 dataLength; nsresult rv; - nsCOMPtr transferable(getter_AddRefs(GetTransferable(kGlobalClipboard))); + nsCOMPtr transferable(GetTransferable(kGlobalClipboard)); // Make sure we have a transferable: if (!transferable) { diff --git a/mozilla/widget/src/gtk2/nsClipboard.cpp b/mozilla/widget/src/gtk2/nsClipboard.cpp index 970d1ad935f..49edcdf5f21 100644 --- a/mozilla/widget/src/gtk2/nsClipboard.cpp +++ b/mozilla/widget/src/gtk2/nsClipboard.cpp @@ -441,7 +441,6 @@ nsClipboard::GetTransferable(PRInt32 aWhichClipboard) else retval = mGlobalTransferable.get(); - NS_IF_ADDREF(retval); return retval; } @@ -471,8 +470,7 @@ nsClipboard::SelectionGetEvent (GtkWidget *aWidget, else return; // THAT AINT NO CLIPBOARD I EVER HEARD OF - nsCOMPtr trans; - trans = getter_AddRefs(GetTransferable(whichClipboard)); + nsCOMPtr trans = GetTransferable(whichClipboard); nsresult rv; nsCOMPtr item; diff --git a/mozilla/widget/src/photon/nsClipboard.cpp b/mozilla/widget/src/photon/nsClipboard.cpp index 037a12fa267..528a4b7ed29 100644 --- a/mozilla/widget/src/photon/nsClipboard.cpp +++ b/mozilla/widget/src/photon/nsClipboard.cpp @@ -207,7 +207,7 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard) //printf(" nsClipboard::SetNativeClipboardData(%i)\n", aWhichClipboard); #endif /* DEBUG_CLIPBOARD */ - nsCOMPtr transferable(getter_AddRefs(GetTransferable(aWhichClipboard))); + nsCOMPtr transferable(GetTransferable(aWhichClipboard)); // make sure we have a good transferable if (nsnull == transferable) @@ -416,9 +416,9 @@ NS_IMETHODIMP nsClipboard::ForceDataToClipboard(PRInt32 aWhichClipboard) #endif /* DEBUG_CLIPBOARD */ // make sure we have a good transferable - nsCOMPtr transferable(getter_AddRefs(GetTransferable(aWhichClipboard))); + nsITransferable *transferable = GetTransferable(aWhichClipboard); - if (nsnull == transferable) + if (!transferable) return NS_ERROR_FAILURE; return NS_OK; @@ -523,7 +523,6 @@ nsITransferable *nsClipboard::GetTransferable(PRInt32 aWhichClipboard) case kSelectionClipboard: break; } - NS_IF_ADDREF(transferable); return transferable; } diff --git a/mozilla/widget/src/xlib/nsClipboard.cpp b/mozilla/widget/src/xlib/nsClipboard.cpp index 32e2565dcf3..5771732fbaa 100644 --- a/mozilla/widget/src/xlib/nsClipboard.cpp +++ b/mozilla/widget/src/xlib/nsClipboard.cpp @@ -197,7 +197,6 @@ nsITransferable *nsClipboard::GetTransferable(PRInt32 aWhichClipboard) transferable = mSelectionTransferable; break; } - NS_IF_ADDREF(transferable); return transferable; } @@ -216,7 +215,7 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard) // get flavor list that includes all flavors that can be written (including ones // obtained through conversion) nsCOMPtr flavorList; - nsCOMPtr transferable(getter_AddRefs(GetTransferable(aWhichClipboard))); + nsCOMPtr transferable(GetTransferable(aWhichClipboard)); // FIXME Need to make sure mTransferable has reference to selectionclipboard. // This solves the problem with copying to an external app.