rem: wwin->screen_ptr->shortcutSelectedWindows[i] = list_remove_elem(wwin->screen_ptr->shortcutSelectedWindows[i], wwin); if (wwin->screen_ptr->shortcutWindow[i] == wwin) { if (wwin->screen_ptr->shortcutSelectedWindows[i]) { LinkedList *list = wwin->screen_ptr->shortcutSelectedWindows[i]; wwin->screen_ptr->shortcutWindow[i] = list->head; } else wwin->screen_ptr->shortcutWindow[i] = NULL; }
add: if (wwin->screen_ptr->shortcutSelectedWindows[i]) { WMRemoveFromBag(wwin->screen_ptr->shortcutSelectedWindows[i], wwin);  if (!WMGetBagItemCount(wwin->screen_ptr->shortcutSelectedWindows[i])) { WMFreeBag(wwin->screen_ptr->shortcutSelectedWindows[i]); wwin->screen_ptr->shortcutSelectedWindows[i] = NULL; } }
context: wWindowDestroy(WWindow *wwin){    int i;    WMRemoveNotificationObserver(wwin);        wwin->flags.destroyed = 1;    for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {        wwin->screen_ptr->shortcutSelectedWindows[i] = list_remove_elem(wwin->screen_ptr->shortcutSelectedWindows[i], wwin);        if (wwin->screen_ptr->shortcutWindow[i] == wwin) {            if (wwin->screen_ptr->shortcutSelectedWindows[i]) {                LinkedList *list = wwin->screen_ptr->shortcutSelectedWindows[i];                wwin->screen_ptr->shortcutWindow[i] =                     list->head;            }            else wwin->screen_ptr->shortcutWindow[i] = NULL;        }    }    if (wwin->normal_hints)      free(wwin->normal_hints);        if (wwin->wm_hints)      XFree(wwin->wm_hints);        if (wwin->wm_instance)      XFree(wwin->wm_instance);    if (wwin->wm_class)      XFree(wwin->wm_class);    if (wwin->wm_gnustep_attr)      free(wwin->wm_gnustep_attr);    if (wwin->cmap_windows)      XFree(wwin->cmap_windows);    XDeleteContext(dpy, wwin->client_win, wWinContext);    if (wwin->frame)	wFrameWindowDestroy(wwin->frame);    if (wwin->icon) {	RemoveFromStackList(wwin->icon->core);        wIconDestroy(wwin->icon);        if (wPreferences.auto_arrange_icons)            wArrangeIcons(wwin->screen_ptr, True);    }    wrelease(wwin);}