Fix crash on startup in mozilla Personal Toolbar. Make the recursive

children killing function more robust.
This commit is contained in:
ramiro 1998-04-30 01:39:28 +00:00
Родитель dcc6e9e245
Коммит 90db4943dc
2 изменённых файлов: 28 добавлений и 28 удалений

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

@ -757,46 +757,52 @@ 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;
XtVaGetValues(children[i],XmNsubMenuId,&submenu,NULL);
Widget submenu = NULL;
WidgetList more_children = NULL;
int num_more_children = 0;
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])) &&
_XfeManagerPrivateComponent(children[i]));
if (!skip)
{
XtDestroyWidget(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