rem: WMAddToArray(wapp_list, wapp);
add: WMAddToArray(wapp_list, (void*)appId);
context: wSessionSaveState(WScreen *scr){    WWindow *wwin = scr->focused_window;    WMPropList *win_info, *wks;    WMPropList *list=NULL;    WMArray *wapp_list=NULL;    make_keys();    if (!scr->session_state) {        scr->session_state = WMCreatePLDictionary(NULL, NULL, NULL);        if (!scr->session_state)            return;    }    list = WMCreatePLArray(NULL);    wapp_list = WMCreateArray(16);    while (wwin) {        WApplication *wapp=wApplicationOf(wwin->main_window);        if ((wwin->transient_for==None             || wwin->transient_for==wwin->screen_ptr->root_win)            && WMGetFirstInArray(wapp_list, wapp)==WANotFound	    && !WFLAGP(wwin, dont_save_session)) {            /* A entry for this application was not yet saved. Save one. */            if ((win_info = makeWindowState(wwin, wapp))!=NULL) {                WMAddToPLArray(list, win_info);                WMReleasePropList(win_info);                /* If we were succesful in saving the info for this window                 * add the application the window belongs to, to the                 * application list, so no multiple entries for the same                 * application are saved.                 */		WMAddToArray(wapp_list, wapp);            }        }        wwin = wwin->prev;    }    WMRemoveFromPLDictionary(scr->session_state, sApplications);    WMPutInPLDictionary(scr->session_state, sApplications, list);    WMReleasePropList(list);    wks = WMCreatePLString(scr->workspaces[scr->current_workspace]->name);    WMPutInPLDictionary(scr->session_state, sWorkspace, wks);    WMReleasePropList(wks);    WMFreeArray(wapp_list);}