Closed Bug 557931 Opened 14 years ago Closed 14 years ago

Crash [@ mozilla::widget::WindowHook::Lookup] with createTaskbarTabPreview

Categories

(Core :: Widget: Win32, defect)

x86
Windows 7
defect
Not set
critical

Tracking

()

RESOLVED FIXED
Tracking Status
blocking1.9.2 --- -
status1.9.2 --- wanted

People

(Reporter: martijn.martijn, Assigned: jimm)

References

Details

(Keywords: crash, testcase)

Crash Data

Attachments

(2 files, 1 obsolete file)

I was trying to use the nsIWinTaskbar service, but I get a crash when using it in the way provided with the testcase.

http://crash-stats.mozilla.com/report/index/15ae59d0-4523-4759-974a-63e7f2100407
0  	xul.dll  	mozilla::widget::WindowHook::Lookup  	 widget/src/windows/WindowHook.cpp:99
1 	xul.dll 	mozilla::widget::WindowHook::LookupOrCreate 	widget/src/windows/WindowHook.cpp:109
2 	xul.dll 	mozilla::widget::WindowHook::AddMonitor 	widget/src/windows/WindowHook.cpp:77
3 	xul.dll 	mozilla::widget::TaskbarPreview::TaskbarPreview 	widget/src/windows/TaskbarPreview.cpp:107
4 	xul.dll 	mozilla::widget::TaskbarTabPreview::TaskbarTabPreview 	widget/src/windows/TaskbarTabPreview.cpp:62
5 	xul.dll 	mozilla::widget::WinTaskbar::CreateTaskbarTabPreview 	widget/src/windows/WinTaskbar.cpp:250
6 	xul.dll 	NS_InvokeByIndex_P 	xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp:102
7 	xul.dll 	XPCWrappedNative::CallMethod 	js/src/xpconnect/src/xpcwrappednative.cpp:2728
8 	xul.dll 	XPC_WN_CallMethod 	js/src/xpconnect/src/xpcwrappednativejsops.cpp:1770
9 	mozjs.dll 	js_Invoke 	js/src/jsinterp.cpp:1364
10 	mozjs.dll 	js_Interpret 	js/src/jsops.cpp:2277
11 	mozjs.dll 	js_Invoke 	js/src/jsinterp.cpp:1372
12 	mozjs.dll 	js_InternalInvoke 	js/src/jsinterp.cpp:1429
13 	mozjs.dll 	JS_CallFunctionValue 	js/src/jsapi.cpp:4957
14 	xul.dll 	nsJSContext::CallEventHandler 	dom/base/nsJSEnvironment.cpp:2161
15 	xul.dll 	nsJSEventListener::HandleEvent 	dom/src/events/nsJSEventListener.cpp:228
16 	xul.dll 	nsEventListenerManager::HandleEventSubType 	content/events/src/nsEventListenerManager.cpp:1082
17 	xul.dll 	nsEventListenerManager::HandleEvent 	content/events/src/nsEventListenerManager.cpp:1198
18 	xul.dll 	nsEventTargetChainItem::HandleEvent 	content/events/src/nsEventDispatcher.cpp:201
19 	xul.dll 	nsEventTargetChainItem::HandleEventTargetChain 	content/events/src/nsEventDispatcher.cpp:326
20 	xul.dll 	nsEventDispatcher::Dispatch 	content/events/src/nsEventDispatcher.cpp:604
21 	xul.dll 	DocumentViewerImpl::LoadComplete 	layout/base/nsDocumentViewer.cpp:1027
22 	xul.dll 	nsDocShell::EndPageLoad 	docshell/base/nsDocShell.cpp:5746
23 	xul.dll 	nsCOMPtr_base::assign_from_qi 	obj-firefox/xpcom/build/nsCOMPtr.cpp:96
24 	xul.dll 	nsDocShell::OnStateChange 	docshell/base/nsDocShell.cpp:5624
Summary: Crash [@ nsGenericElement::SetAttr] with createTaskbarTabPreview → Crash [@ mozilla::widget::WindowHook::Lookup] with createTaskbarTabPreview
GetHWNDFromDocShell for the doc shell is failing, returning a null hwnd, which in turn retrieves a null nsWindow object which we invoke in GetWindowHook().

We should add a null check in CreateTaskbarTabPreview on toplevelHWND, and fail if that fails.
(In reply to comment #1)
> GetHWNDFromDocShell for the doc shell is failing, returning a null hwnd, which
> in turn retrieves a null nsWindow object which we invoke in GetWindowHook().
> 
> We should add a null check in CreateTaskbarTabPreview on toplevelHWND, and fail
> if that fails.

We return NULL in some cases from GetHWNDFromDocShell if we can't QI the nsIBaseWindow. Patch coming up.
Attached patch fix (obsolete) — Splinter Review
GetAncestor doesn't seem to mind the null value for the hwnd, so this should suffice.
Assignee: nobody → jmathies
Attachment #437707 - Flags: review?(tellrob)
Comment on attachment 437707 [details] [diff] [review]
fix

we need this in GetTaskbarWindowPreview as well.
Attachment #437707 - Flags: review?(tellrob) → review-
Attached patch fixSplinter Review
Somewhat overkill since GetNSWindowPtr should return null for a null hwnd, but just to be safe.
Attachment #437707 - Attachment is obsolete: true
Attachment #437709 - Flags: review?(tellrob)
Attachment #437709 - Flags: review?(tellrob) → review+
http://hg.mozilla.org/mozilla-central/rev/549329a134b8
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment on attachment 437709 [details] [diff] [review]
fix

This crash exists in 1.9.2 as well. See bug 618240. Requesting blocking, it's a simple no risk patch.
Attachment #437709 - Flags: approval1.9.2.14?
Blocks: 618240
Comment on attachment 437709 [details] [diff] [review]
fix

Approved for 1.9.2.15, a=dveditz for release-drivers
Attachment #437709 - Flags: approval1.9.2.14? → approval1.9.2.14+
Comment on attachment 437709 [details] [diff] [review]
fix

Moving the flag to the correct release.
Attachment #437709 - Flags: approval1.9.2.14+ → approval1.9.2.15+
Comment on attachment 437709 [details] [diff] [review]
fix

Didn't make the code-freeze for non-blockers, you can try again next time.
Attachment #437709 - Flags: approval1.9.2.17+ → approval1.9.2.17-
blocking1.9.2: --- → .18+
Comment on attachment 437709 [details] [diff] [review]
fix

Please land this for 1.9.2.18
Attachment #437709 - Flags: approval1.9.2.18+
blocking1.9.2: .18+ → -
Not going to track this one. If it makes it today it makes it, if not that's fine too.
Crash Signature: [@ mozilla::widget::WindowHook::Lookup]
Comment on attachment 437709 [details] [diff] [review]
fix

Didn't make 3.6.18
Attachment #437709 - Flags: approval1.9.2.18+ → approval1.9.2.18-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: