support weak references in TestGtkEmbed's content listener (bug 191548). r=pavlov, sr=blizzard, a=asa.

git-svn-id: svn://10.0.0.236/trunk@137498 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%netscape.com
2003-02-06 20:59:30 +00:00
parent f6bc58de92
commit fef49a3191
3 changed files with 7 additions and 4 deletions

View File

@@ -36,8 +36,9 @@ EmbedContentListener::~EmbedContentListener()
{
}
NS_IMPL_ISUPPORTS1(EmbedContentListener,
nsIURIContentListener)
NS_IMPL_ISUPPORTS2(EmbedContentListener,
nsIURIContentListener,
nsISupportsWeakReference)
nsresult
EmbedContentListener::Init(EmbedPrivate *aOwner)

View File

@@ -23,10 +23,12 @@
#define __EmbedContentListener_h
#include <nsIURIContentListener.h>
#include <nsWeakReference.h>
class EmbedPrivate;
class EmbedContentListener : public nsIURIContentListener
class EmbedContentListener : public nsIURIContentListener,
public nsSupportsWeakReference
{
public:

View File

@@ -136,7 +136,7 @@ EmbedPrivate::Init(GtkMozEmbed *aOwningWidget)
// It is assumed that this will be destroyed when we go out of
// scope.
mContentListener = new EmbedContentListener();
mContentListenerGuard = mContentListener;
mContentListenerGuard = NS_STATIC_CAST(nsISupports*, NS_STATIC_CAST(nsIURIContentListener*, mContentListener));
mContentListener->Init(this);
// Create our key listener object and initialize it. It is assumed