Bug 708278 - Prevent recursion in ReportMoveEvent(), which can become infinite. r=bgirard a=maconly

This commit is contained in:
Steven Michaud 2011-12-13 10:55:16 -06:00
Родитель 6991ff4007
Коммит b723654ff1
2 изменённых файлов: 14 добавлений и 0 удалений

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

@ -342,6 +342,8 @@ protected:
bool mFullScreen;
bool mModal;
bool mInReportMoveEvent; // true if in a call to ReportMoveEvent().
PRInt32 mNumModalDescendents;
InputContext mInputContext;
};

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

@ -139,6 +139,7 @@ nsCocoaWindow::nsCocoaWindow()
, mSheetNeedsShow(false)
, mFullScreen(false)
, mModal(false)
, mInReportMoveEvent(false)
, mNumModalDescendents(0)
{
@ -1364,6 +1365,15 @@ nsCocoaWindow::ReportMoveEvent()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
// Prevent recursion, which can become infinite (see bug 708278). This
// can happen when the call to [NSWindow setFrameTopLeftPoint:] in
// nsCocoaWindow::Move() triggers an immediate NSWindowDidMove notification
// (and a call to [WindowDelegate windowDidMove:]).
if (mInReportMoveEvent) {
return;
}
mInReportMoveEvent = true;
UpdateBounds();
// Dispatch the move event to Gecko
@ -1374,6 +1384,8 @@ nsCocoaWindow::ReportMoveEvent()
nsEventStatus status = nsEventStatus_eIgnore;
DispatchEvent(&guiEvent, status);
mInReportMoveEvent = false;
NS_OBJC_END_TRY_ABORT_BLOCK;
}