Merge pull request #4970 from hardening/uwac_fixes

uwac: change seat API to not reference disposed UwacSeat
This commit is contained in:
akallabeth 2018-10-25 15:54:21 +02:00 committed by GitHub
commit c3c9783e63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

View File

@ -37,6 +37,7 @@ typedef struct uwac_display UwacDisplay;
typedef struct uwac_output UwacOutput;
typedef struct uwac_window UwacWindow;
typedef struct uwac_seat UwacSeat;
typedef uint32_t UwacSeatId;
/** @brief error codes */
@ -111,7 +112,12 @@ struct uwac_new_seat_event {
};
typedef struct uwac_new_seat_event UwacSeatNewEvent;
typedef struct uwac_new_seat_event UwacSeatRemovedEvent;
struct uwac_removed_seat_event {
int type;
UwacSeatId id;
};
typedef struct uwac_removed_seat_event UwacSeatRemovedEvent;
struct uwac_keyboard_enter_event {
int type;
@ -213,6 +219,7 @@ union uwac_event {
int type;
UwacOutputNewEvent output_new;
UwacSeatNewEvent seat_new;
UwacSeatRemovedEvent seat_removed;
UwacPointerEnterLeaveEvent mouse_enter_leave;
UwacPointerMotionEvent mouse_motion;
UwacPointerButtonEvent mouse_button;
@ -479,6 +486,14 @@ UWAC_API UwacReturnCode UwacNextEvent(UwacDisplay *display, UwacEvent *event);
*/
UWAC_API const char *UwacSeatGetName(const UwacSeat *seat);
/**
* returns the id of the given UwacSeat
*
* @param seat the UwacSeat
* @return the id of the seat
*/
UWAC_API UwacSeatId UwacSeatGetId(const UwacSeat *seat);
#ifdef __cplusplus
}
#endif

View File

@ -270,7 +270,7 @@ static void registry_handle_global_remove(void* data, struct wl_registry* regist
ev = (UwacSeatRemovedEvent*)UwacDisplayNewEvent(d, UWAC_EVENT_REMOVED_SEAT);
if (ev)
ev->seat = seat;
ev->id = name;
}
wl_list_remove(&global->link);

View File

@ -865,3 +865,7 @@ void UwacSeatDestroy(UwacSeat *s) {
const char *UwacSeatGetName(const UwacSeat *seat) {
return seat->name;
}
UwacSeatId UwacSeatGetId(const UwacSeat *seat) {
return seat->seat_id;
}