--- a/widget/src/qt/nsCommonWidget.cpp
+++ b/widget/src/qt/nsCommonWidget.cpp
@@ -802,26 +802,27 @@ nsCommonWidget::SetPreferredSize(int w,
}
NS_IMETHODIMP
nsCommonWidget::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus &aStatus)
{
aStatus = nsEventStatus_eIgnore;
// hold a widget reference while we dispatch this event
- NS_ADDREF(aEvent->widget);
+ nsIWidget* widget = aEvent->widget;
+ NS_ADDREF(widget);
if (mEventCallback)
aStatus = (*mEventCallback)(aEvent);
// dispatch to event listener if event was not consumed
if ((aStatus != nsEventStatus_eIgnore) && mEventListener)
aStatus = mEventListener->ProcessEvent(*aEvent);
- NS_IF_RELEASE(aEvent->widget);
+ NS_IF_RELEASE(widget);
return NS_OK;
}
NS_IMETHODIMP
nsCommonWidget::CaptureRollupEvents(nsIRollupListener*, PRBool, PRBool)
{
return NS_OK;