Add safety checks to ChildView's getScrollableView. Crash fix. b=493238 r=mstange a=dveditz

git-svn-id: svn://10.0.0.236/trunk@258448 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
joshmoz%gmail.com 2009-09-22 01:28:52 +00:00
parent a1935cc6b9
commit 488a89e02f

View File

@ -2333,13 +2333,10 @@ NSEvent* gLastDragEvent = nil;
// we have to loop up through superviews in case the view that received the // we have to loop up through superviews in case the view that received the
// mouseDown is in fact a plugin view with no scrollbars // mouseDown is in fact a plugin view with no scrollbars
while (currView) { while (currView) {
// This is a hack I learned in nsView::GetViewFor(nsIWidget* aWidget) nsIWidget* widget = [currView widget];
// that I'm not sure is kosher. If anyone knows a better way to get if (widget) {
// the view for a widget, I'd love to hear it. --Nathan
void* clientData; void* clientData;
[currView widget]->GetClientData(clientData); if (NS_SUCCEEDED(widget->GetClientData(clientData))) {
nsISupports* data = (nsISupports*)clientData; nsISupports* data = (nsISupports*)clientData;
nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(data)); nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(data));
if (req) { if (req) {
@ -2347,9 +2344,12 @@ NSEvent* gLastDragEvent = nil;
if (scrollableView) if (scrollableView)
break; break;
} }
}
}
if ([[currView superview] isMemberOfClass:[ChildView class]]) NSView* superview = [currView superview];
currView = (ChildView*)[currView superview]; if (superview && [superview isMemberOfClass:[ChildView class]])
currView = (ChildView*)superview;
else else
currView = nil; currView = nil;
} }