Switching to use NS_WITH_SERVICE macro as specified in (5403); removing spurious clipboard service instance in nsEditorEventListeners.cpp. r=akkana, a=chofmann.

This commit is contained in:
mcafee%netscape.com 1999-11-05 01:29:49 +00:00
Родитель 9abdf3c566
Коммит 358d5d1399
4 изменённых файлов: 8 добавлений и 16 удалений

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

@ -45,7 +45,6 @@
// Drag & Drop, Clipboard
#include "nsIServiceManager.h"
#include "nsWidgetsCID.h"
#include "nsIClipboard.h"
#include "nsIDragService.h"
#include "nsIDragSession.h"
#include "nsITransferable.h"
@ -60,7 +59,6 @@ static NS_DEFINE_CID(kCDragServiceCID, NS_DRAGSERVICE_CID);
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
static NS_DEFINE_IID(kCDataFlavorCID, NS_DATAFLAVOR_CID);
static NS_DEFINE_IID(kContentIteratorCID, NS_CONTENTITERATOR_CID);
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
static NS_DEFINE_IID(kCXIFConverterCID, NS_XIFFORMATCONVERTER_CID);

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

@ -45,7 +45,6 @@
// Drag & Drop, Clipboard
#include "nsIServiceManager.h"
#include "nsWidgetsCID.h"
#include "nsIClipboard.h"
#include "nsIDragService.h"
#include "nsIDragSession.h"
#include "nsITransferable.h"
@ -60,7 +59,6 @@ static NS_DEFINE_CID(kCDragServiceCID, NS_DRAGSERVICE_CID);
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
static NS_DEFINE_IID(kCDataFlavorCID, NS_DATAFLAVOR_CID);
static NS_DEFINE_IID(kContentIteratorCID, NS_CONTENTITERATOR_CID);
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
static NS_DEFINE_IID(kCXIFConverterCID, NS_XIFFORMATCONVERTER_CID);

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

@ -1734,7 +1734,8 @@ PresShell::DoCopy()
GetDocument(getter_AddRefs(doc));
if (doc) {
nsString buffer;
nsresult rv;
nsIDOMSelection* sel = nsnull;
GetSelection(SELECTION_NORMAL, &sel);
@ -1743,10 +1744,8 @@ PresShell::DoCopy()
NS_IF_RELEASE(sel);
// Get the Clipboard
nsIClipboard* clipboard = nsnull;
nsresult rv = nsServiceManager::GetService(kCClipboardCID,
nsIClipboard::GetIID(),
(nsISupports **)&clipboard);
NS_WITH_SERVICE(nsIClipboard, clipboard, kCClipboardCID, &rv);
if (NS_FAILED(rv)) return rv;
if ( clipboard ) {
// Create a transferable for putting data on the Clipboard
@ -1787,7 +1786,6 @@ PresShell::DoCopy()
clipboard->SetData(trans, nsnull);
}
}
nsServiceManager::ReleaseService(kCClipboardCID, clipboard);
}
}
return NS_OK;

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

@ -1734,7 +1734,8 @@ PresShell::DoCopy()
GetDocument(getter_AddRefs(doc));
if (doc) {
nsString buffer;
nsresult rv;
nsIDOMSelection* sel = nsnull;
GetSelection(SELECTION_NORMAL, &sel);
@ -1743,10 +1744,8 @@ PresShell::DoCopy()
NS_IF_RELEASE(sel);
// Get the Clipboard
nsIClipboard* clipboard = nsnull;
nsresult rv = nsServiceManager::GetService(kCClipboardCID,
nsIClipboard::GetIID(),
(nsISupports **)&clipboard);
NS_WITH_SERVICE(nsIClipboard, clipboard, kCClipboardCID, &rv);
if (NS_FAILED(rv)) return rv;
if ( clipboard ) {
// Create a transferable for putting data on the Clipboard
@ -1787,7 +1786,6 @@ PresShell::DoCopy()
clipboard->SetData(trans, nsnull);
}
}
nsServiceManager::ReleaseService(kCClipboardCID, clipboard);
}
}
return NS_OK;