Mon Oct 4 12:56:07 PDT 1999

(Raster)

patch to stop possible endless loops in ipc for menu reloading


SVN revision: 639
This commit is contained in:
Carsten Haitzler 1999-10-04 17:05:11 +00:00
parent 7b6303c5ea
commit 79d4a0cc5c
2 changed files with 34 additions and 9 deletions

View File

@ -2983,3 +2983,10 @@ Mon Oct 4 12:25:23 PDT 1999
removed apply button from groups break dialog since it was breaking all sorts
of stuff.
-------------------------------------------------------------------------------
Mon Oct 4 12:56:07 PDT 1999
(Raster)
patch to stop possible endless loops in ipc for menu reloading

View File

@ -4797,19 +4797,37 @@ IPC_ReloadMenus(char *params, Client * c)
* but i'll try this 08/17/99
*/
Menu *m = NULL;
int i, not_task = 1;
Menu *menu;
Menu **menus;
int i, j, num, not_task, found_one = 1;
/* Free all menustyles first (gulp) */
for (m = FindItem(NULL, 0, LIST_FINDBY_NONE, LIST_TYPE_MENU); m;
m = FindItem(NULL, 0, LIST_FINDBY_NONE, LIST_TYPE_MENU))
do
{
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
if (m == task_menu[i])
not_task = 0;
if ((m != desk_menu) && (m != group_menu) && not_task)
DestroyMenu(m);
found_one = 0;
menus = (Menu **) ListItemType(&num, LIST_TYPE_MENU);
for (i = 0; i < num; i++)
{
menu = menus[i];
not_task = 1;
for (j = 0; j < ENLIGHTENMENT_CONF_NUM_DESKTOPS; j++)
if (menu == task_menu[j])
not_task = 0;
if ((menu != desk_menu) && (menu != group_menu) && not_task)
{
DestroyMenu(menu);
/* Destroying a menu may result in sub-menus being
* destroyed too, so we have to re-find all menus
* afterwards. Inefficient yes, but it works...
*/
found_one = 1;
break;
}
}
if (menus)
Efree(menus);
}
while (found_one);
LoadConfigFile("menus.cfg");