xwm: Fix icon surface ownership
The cairo surface used for the icon must be completely given to the frame as soon as said frame has been created. To prevent both the window and the frame from sharing ownership of the icon, we set window->icon_surface back to NULL right after creating or changing the frame, only keeping it there when no frame has been created yet. Fixes https://lists.freedesktop.org/archives/wayland-devel/2018-January/036655.html Reported-by: Derek Foreman <derekf@osg.samsung.com> Tested-by: Derek Foreman <derekf@osg.samsung.com> Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
This commit is contained in:
committed by
Daniel Stone
parent
5e12b553b1
commit
44fc1be913
@@ -135,6 +135,10 @@ frame_destroy(struct frame *frame);
|
||||
int
|
||||
frame_set_title(struct frame *frame, const char *title);
|
||||
|
||||
/* May set FRAME_STATUS_REPAINT */
|
||||
void
|
||||
frame_set_icon(struct frame *frame, cairo_surface_t *icon);
|
||||
|
||||
/* May set FRAME_STATUS_REPAINT */
|
||||
void
|
||||
frame_set_flag(struct frame *frame, enum frame_flag flag);
|
||||
|
||||
@@ -448,6 +448,20 @@ frame_set_title(struct frame *frame, const char *title)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
frame_set_icon(struct frame *frame, cairo_surface_t *icon)
|
||||
{
|
||||
struct frame_button *button;
|
||||
wl_list_for_each(button, &frame->buttons, link) {
|
||||
if (button->status_effect != FRAME_STATUS_MENU)
|
||||
continue;
|
||||
if (button->icon)
|
||||
cairo_surface_destroy(button->icon);
|
||||
button->icon = icon;
|
||||
frame->status |= FRAME_STATUS_REPAINT;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
frame_set_flag(struct frame *frame, enum frame_flag flag)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user