From fef49a3191b50e8347ab37ff8aebacc5b2bdc786 Mon Sep 17 00:00:00 2001 From: "bryner%netscape.com" Date: Thu, 6 Feb 2003 20:59:30 +0000 Subject: [PATCH] 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 --- mozilla/embedding/browser/gtk/src/EmbedContentListener.cpp | 5 +++-- mozilla/embedding/browser/gtk/src/EmbedContentListener.h | 4 +++- mozilla/embedding/browser/gtk/src/EmbedPrivate.cpp | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mozilla/embedding/browser/gtk/src/EmbedContentListener.cpp b/mozilla/embedding/browser/gtk/src/EmbedContentListener.cpp index 5286cf6e8f5..912c8e718dc 100644 --- a/mozilla/embedding/browser/gtk/src/EmbedContentListener.cpp +++ b/mozilla/embedding/browser/gtk/src/EmbedContentListener.cpp @@ -36,8 +36,9 @@ EmbedContentListener::~EmbedContentListener() { } -NS_IMPL_ISUPPORTS1(EmbedContentListener, - nsIURIContentListener) +NS_IMPL_ISUPPORTS2(EmbedContentListener, + nsIURIContentListener, + nsISupportsWeakReference) nsresult EmbedContentListener::Init(EmbedPrivate *aOwner) diff --git a/mozilla/embedding/browser/gtk/src/EmbedContentListener.h b/mozilla/embedding/browser/gtk/src/EmbedContentListener.h index c5cf1911ef8..dfe81a55ed5 100644 --- a/mozilla/embedding/browser/gtk/src/EmbedContentListener.h +++ b/mozilla/embedding/browser/gtk/src/EmbedContentListener.h @@ -23,10 +23,12 @@ #define __EmbedContentListener_h #include +#include class EmbedPrivate; -class EmbedContentListener : public nsIURIContentListener +class EmbedContentListener : public nsIURIContentListener, + public nsSupportsWeakReference { public: diff --git a/mozilla/embedding/browser/gtk/src/EmbedPrivate.cpp b/mozilla/embedding/browser/gtk/src/EmbedPrivate.cpp index d1761869334..b660aa6a55a 100644 --- a/mozilla/embedding/browser/gtk/src/EmbedPrivate.cpp +++ b/mozilla/embedding/browser/gtk/src/EmbedPrivate.cpp @@ -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