Changeset 1e3ea91 in mainline
- Timestamp:
- 2013-04-21T16:45:39Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 21eeb653
- Parents:
- 289cb7dd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/compositor/compositor.c
r289cb7dd r1e3ea91 90 90 typedef struct { 91 91 link_t link; 92 atomic_t ref_cnt; 92 93 service_id_t in_dsid; 93 94 service_id_t out_dsid; … … 215 216 216 217 link_initialize(&win->link); 218 atomic_set(&win->ref_cnt, 0); 217 219 prodcons_initialize(&win->queue); 218 220 transform_identity(&win->transform); … … 232 234 static void window_destroy(window_t *win) 233 235 { 234 if (win) { 236 if (win && atomic_get(&win->ref_cnt) == 0) { 237 while (!list_empty(&win->queue.list)) { 238 window_event_t *event = (window_event_t *) list_first(&win->queue.list); 239 list_remove(&event->link); 240 free(event); 241 } 242 235 243 if (win->surface) { 236 244 surface_destroy(win->surface); … … 695 703 } 696 704 705 loc_service_unregister(win->in_dsid); 706 loc_service_unregister(win->out_dsid); 707 708 /* In case the client was killed, input fibril of the window might be 709 * still blocked on the condition within comp_window_get_event. */ 710 window_event_t *event_dummy = (window_event_t *) malloc(sizeof(window_event_t)); 711 if (event_dummy) { 712 link_initialize(&event_dummy->link); 713 prodcons_produce(&win->queue, &event_dummy->link); 714 } 715 697 716 /* Calculate damage. */ 698 717 sysarg_t x = 0; … … 706 725 } 707 726 708 /* Release window resources. */709 loc_service_unregister(win->in_dsid);710 loc_service_unregister(win->out_dsid);711 while (!list_empty(&win->queue.list)) {712 list_remove(list_first(&win->queue.list));713 }714 window_destroy(win);715 716 727 comp_damage(x, y, width, height); 717 728 … … 813 824 814 825 if (win) { 826 atomic_inc(&win->ref_cnt); 815 827 async_answer_0(iid, EOK); 816 828 } else { … … 825 837 826 838 if (!IPC_GET_IMETHOD(call)) { 827 async_answer_0(callid, EINVAL); 839 async_answer_0(callid, EOK); 840 atomic_dec(&win->ref_cnt); 841 window_destroy(win); 828 842 return; 829 843 } … … 842 856 843 857 if (!IPC_GET_IMETHOD(call)) { 844 async_answer_0(callid, EINVAL); 858 comp_window_close(win, callid, &call); 859 atomic_dec(&win->ref_cnt); 860 window_destroy(win); 845 861 return; 846 862 } … … 857 873 break; 858 874 case WINDOW_CLOSE: 859 comp_window_close(win, callid, &call); 875 /* Postpone the closing until the phone is hung up to cover 876 * the case when the client is killed abruptly. */ 877 async_answer_0(callid, EOK); 860 878 break; 861 879 case WINDOW_CLOSE_REQUEST:
Note:
See TracChangeset
for help on using the changeset viewer.