Last Comment Bug 763849 - Uninitialised value use in nsWindow::Show(bool aState)
: Uninitialised value use in nsWindow::Show(bool aState)
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Widget (show other bugs)
: Trunk
: ARM Gonk (Firefox OS)
: -- normal (vote)
: mozilla16
Assigned To: Michael Wu [:mwu]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-12 00:48 PDT by Julian Seward [:jseward]
Modified: 2012-07-24 13:33 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
-


Attachments
Initialize mVisible in Create (546 bytes, patch)
2012-06-12 01:08 PDT, Michael Wu [:mwu]
cjones.bugs: review+
jseward: feedback+
Details | Diff | Splinter Review

Description Julian Seward [:jseward] 2012-06-12 00:48:08 PDT
(the one in widget/gonk/nsWindow.cpp)

When starting B2G on GalaxyS2, I got the complaint shown below,
plus probably related other ones.

The complained-about line is widget/gonk/nsWindow.cpp:301

    if (mVisible == aState)

A bit of grepping around suggests the relevant constructor,
nsWindow::nsWindow(), at the same file line 121, does not initialise
mVisible.

Conditional jump or move depends on uninitialised value(s)
   at 0x5844612: nsWindow::Show(bool) (widget/gonk/nsWindow.cpp:301)
   by 0x51FABD3: DocumentViewerImpl::Hide() (layout/base/nsDocumentViewer.cpp:2028)
   by 0x51FA879: DocumentViewerImpl::InitInternal(nsIWidget*, nsISupports*, nsIntRect const&, bool, bool, bool) (layout/base/nsDocumentViewer.cpp:891)
   by 0x51FAA57: DocumentViewerImpl::Init(nsIWidget*, nsIntRect const&) (layout/base/nsDocumentViewer.cpp:676)
   by 0x572B8E3: nsDocShell::SetupNewViewer(nsIContentViewer*) (docshell/base/nsDocShell.cpp:7801)
   by 0x572C11B: nsDocShell::Embed(nsIContentViewer*, char const*, nsISupports*) (docshell/base/nsDocShell.cpp:5880)
   by 0x5730DC1: nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal*, nsIURI*, bool) (docshell/base/nsDocShell.cpp:6615)
   by 0x5731235: nsDocShell::EnsureContentViewer() (docshell/base/nsDocShell.cpp:6508)
   by 0x573207F: nsDocShell::GetInterface(nsID const&, void**) (docshell/base/nsDocShell.cpp:941)
   by 0x598A1DB: nsGetInterface::operator()(nsID const&, void**) const (/home/sewardj/B2G-1/B2G/objdir-gecko/xpcom/build/nsIInterfaceRequestorUtils.cpp:19)
   by 0x598929D: nsCOMPtr_base::assign_from_helper(nsCOMPtr_helper const&, nsID const&) (/home/sewardj/B2G-1/B2G/objdir-gecko/xpcom/build/nsCOMPtr.cpp:117)
   by 0x54A20A3: nsGlobalWindow::GetDocument(nsIDOMDocument**) (/home/sewardj/B2G-1/B2G/objdir-gecko/dom/base/../../dist/include/nsCOMPtr.h:598)

 Uninitialised value was created by a heap allocation
   at 0x48067E0: malloc (/home/sewardj/VgTRUNK/trunk-b2g/coregrind/m_replacemalloc/vg_replace_malloc.c:267)
   by 0x5DEC767: moz_xmalloc (memory/mozalloc/mozalloc.cpp:54)
   by 0x5843377: nsWindowConstructor(nsISupports*, nsID const&, void**) (/home/sewardj/B2G-1/B2G/objdir-gecko/widget/gonk/../../dist/include/mozilla/mozalloc.h:200)
   by 0x598DF5B: mozilla::GenericFactory::CreateInstance(nsISupports*, nsID const&, void**) (/home/sewardj/B2G-1/B2G/objdir-gecko/xpcom/build/GenericFactory.cpp:16)
   by 0x59AD0A9: nsComponentManagerImpl::CreateInstance(nsID const&, nsISupports*, nsID const&, void**) (xpcom/components/nsComponentManager.cpp:944)
   by 0x5989B05: CallCreateInstance(nsID const&, nsISupports*, nsID const&, void**) (/home/sewardj/B2G-1/B2G/objdir-gecko/xpcom/build/nsComponentManagerUtils.cpp:125)
   by 0x5989B23: nsCreateInstanceByCID::operator()(nsID const&, void**) const (/home/sewardj/B2G-1/B2G/objdir-gecko/xpcom/build/nsComponentManagerUtils.cpp:167)
   by 0x598929D: nsCOMPtr_base::assign_from_helper(nsCOMPtr_helper const&, nsID const&) (/home/sewardj/B2G-1/B2G/objdir-gecko/xpcom/build/nsCOMPtr.cpp:117)
   by 0x5862F93: nsBaseWidget::CreateChild(nsIntRect const&, nsEventStatus (*)(nsGUIEvent*), nsDeviceContext*, nsWidgetInitData*, bool) (/home/sewardj/B2G-1/B2G/objdir-gecko/widget/xpwidgets/../../dist/include/nsCOMPtr.h:684)
   by 0x5489EE9: nsView::CreateWidgetForParent(nsIWidget*, nsWidgetInitData*, bool, bool) (view/src/nsView.cpp:730)
   by 0x5489F4D: nsIView::CreateWidgetForParent(nsIWidget*, nsWidgetInitData*, bool, bool) (view/src/nsView.cpp:641)
   by 0x51F8209: DocumentViewerImpl::MakeWindow(nsSize const&, nsIView*) (layout/base/nsDocumentViewer.cpp:2311)
Comment 1 Michael Wu [:mwu] 2012-06-12 01:08:22 PDT
Created attachment 632159 [details] [diff] [review]
Initialize mVisible in Create
Comment 2 Julian Seward [:jseward] 2012-06-13 15:59:51 PDT
Comment on attachment 632159 [details] [diff] [review]
Initialize mVisible in Create

Yes, that makes the complaints go away.
Comment 4 Ed Morley [:emorley] 2012-06-21 04:05:58 PDT
https://hg.mozilla.org/mozilla-central/rev/5ce9ee29d71b

Note You need to log in before you can comment on or make changes to this bug.