nsITransferable* nsClipboard::GetTransferable() returns an addrefed raw pointer
r=timeless sr=blizzard
This commit is contained in:
caillon%returnzero.com 2003-11-18 20:54:29 +00:00
Родитель 66a72b9daa
Коммит ef584aa52e
4 изменённых файлов: 9 добавлений и 14 удалений

Просмотреть файл

@ -303,7 +303,7 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard)
GdkAtom selectionAtom = GetSelectionAtom(aWhichClipboard);
nsCOMPtr<nsITransferable> transferable(getter_AddRefs(GetTransferable(aWhichClipboard)));
nsCOMPtr<nsITransferable> 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<nsITransferable> transferable(getter_AddRefs(GetTransferable(aWhichClipboard)));
nsCOMPtr<nsITransferable> 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<nsITransferable> transferable(getter_AddRefs(cb->GetTransferable(whichClipboard)));
nsCOMPtr<nsITransferable> 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<nsITransferable> transferable(getter_AddRefs(GetTransferable(kGlobalClipboard)));
nsCOMPtr<nsITransferable> transferable(GetTransferable(kGlobalClipboard));
// Make sure we have a transferable:
if (!transferable) {

Просмотреть файл

@ -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<nsITransferable> trans;
trans = getter_AddRefs(GetTransferable(whichClipboard));
nsCOMPtr<nsITransferable> trans = GetTransferable(whichClipboard);
nsresult rv;
nsCOMPtr<nsISupports> item;

Просмотреть файл

@ -207,7 +207,7 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard)
//printf(" nsClipboard::SetNativeClipboardData(%i)\n", aWhichClipboard);
#endif /* DEBUG_CLIPBOARD */
nsCOMPtr<nsITransferable> transferable(getter_AddRefs(GetTransferable(aWhichClipboard)));
nsCOMPtr<nsITransferable> 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<nsITransferable> 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;
}

Просмотреть файл

@ -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<nsISupportsArray> flavorList;
nsCOMPtr<nsITransferable> transferable(getter_AddRefs(GetTransferable(aWhichClipboard)));
nsCOMPtr<nsITransferable> transferable(GetTransferable(aWhichClipboard));
// FIXME Need to make sure mTransferable has reference to selectionclipboard.
// This solves the problem with copying to an external app.