mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Fix crash on startup in mozilla Personal Toolbar. Make the recursive
children killing function more robust.
This commit is contained in:
parent
dcc6e9e245
commit
90db4943dc
@ -757,41 +757,47 @@ XfeMenuType(Widget menu)
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ void
|
||||
XfeDestroyMenuWidgetTree(WidgetList children,
|
||||
int num_children,
|
||||
Boolean skip_private_components)
|
||||
XfeDestroyMenuWidgetTree(WidgetList children,
|
||||
int num_children,
|
||||
Boolean skip_private_components)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if ((num_children <= 0) || (children == NULL))
|
||||
if (num_children <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = num_children - 1; i >= 0; i--)
|
||||
for (i = num_children - 1; i >= 0; i--)
|
||||
{
|
||||
Boolean skip = False;
|
||||
/* Widget submenu = XfeCascadeGetSubMenu(children[i]); */
|
||||
Widget submenu;
|
||||
Widget submenu = NULL;
|
||||
WidgetList more_children = NULL;
|
||||
int num_more_children = 0;
|
||||
|
||||
XtVaGetValues(children[i],XmNsubMenuId,&submenu,NULL);
|
||||
XtVaGetValues (children[i], XmNsubMenuId, &submenu, 0);
|
||||
|
||||
/* If a submenu exists, then this item has descendants */
|
||||
if (submenu)
|
||||
{
|
||||
/*
|
||||
* I think we should use submenu instead of children[i],
|
||||
* but this is how the original code was written.
|
||||
*
|
||||
* I need to think about this some more...
|
||||
*/
|
||||
if (_XfemChildren(children[i]) && _XfemNumChildren(children[i]))
|
||||
XtVaGetValues(children[i],
|
||||
XmNchildren, &more_children,
|
||||
XmNnumChildren, &num_more_children,
|
||||
NULL);
|
||||
|
||||
if (num_more_children > 0)
|
||||
{
|
||||
XfeDestroyMenuWidgetTree(_XfemChildren(children[i]),
|
||||
_XfemNumChildren(children[i]),
|
||||
XfeDestroyMenuWidgetTree(more_children,
|
||||
num_more_children,
|
||||
skip_private_components);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip destruction of this widget if its requested and its
|
||||
* parent is an XfeManager and its a private component - not
|
||||
* meant to be messed with.
|
||||
*/
|
||||
skip = (skip_private_components &&
|
||||
XfeIsAlive(_XfeParent(children[i])) &&
|
||||
XfeIsManager(_XfeParent(children[i])) &&
|
||||
|
@ -135,14 +135,8 @@ XFE_PersonalToolbar::XFE_PersonalToolbar(MWContext * bookmarkContext,
|
||||
// Install the destruction handler
|
||||
installDestroyHandler();
|
||||
|
||||
// The following call seems to be crashing the browser for some
|
||||
// people. I cannot reproduce the problem yet. Im working on
|
||||
// finding a real solution, but I dont want the browser to
|
||||
// crash on startup on the next mozilla release. -re
|
||||
#if 0
|
||||
// Force the items to update
|
||||
reallyUpdateRoot();
|
||||
#endif
|
||||
|
||||
// If we are supposed to have a toolbar folder, but it does not
|
||||
// exist, then we need to create one and populate it with the default
|
||||
|
Loading…
Reference in New Issue
Block a user