Fix crasher on linux for tooltips. Widget was going away before we could unregister things. Make sure we addref it if we're going to hold onto it for an extended period of time. Thanks alecf for finding this. bug # 38547.

This commit is contained in:
pinkerton%netscape.com 2000-05-09 22:05:50 +00:00
Родитель e82a7c8b5f
Коммит 97e1341962
2 изменённых файлов: 7 добавлений и 4 удалений

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

@ -38,7 +38,7 @@ NS_IMPL_QUERY_INTERFACE3(nsMenuDismissalListener, nsIDOMMouseListener, nsIMenuRo
////////////////////////////////////////////////////////////////////////
nsMenuDismissalListener::nsMenuDismissalListener() :
mWidget(0), mEnabled(PR_TRUE)
mEnabled(PR_TRUE)
{
NS_INIT_REFCNT();
mMenuParent = nsnull;
@ -162,8 +162,10 @@ nsMenuDismissalListener::NextMenuParent(nsIMenuParent * inCurrent, nsIMenuParent
NS_IMETHODIMP
nsMenuDismissalListener::Unregister()
{
if (mWidget)
mWidget->CaptureRollupEvents(this, PR_FALSE, PR_FALSE);
if (mWidget) {
mWidget->CaptureRollupEvents(this, PR_FALSE, PR_FALSE);
mWidget = nsnull;
}
NS_RELEASE(nsMenuFrame::mDismissalListener);
return NS_OK;

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

@ -29,6 +29,7 @@
#include "nsIRollupListener.h"
#include "nsIMenuRollup.h"
#include "nsIDOMEventReceiver.h"
#include "nsCOMPtr.h"
class nsMenuPopupFrame;
class nsIPresContext;
@ -66,7 +67,7 @@ public:
protected:
nsIMenuParent* mMenuParent;
nsIWidget* mWidget;
nsCOMPtr<nsIWidget> mWidget;
PRBool mEnabled;
};