Skip to content

Fix leaking blur/contrast/region object

Xuetian Weng requested to merge work/leaking-blur into master

Blur/contrast object does not need to be re-created everytime install a new blur. Otherwise blur/contrast object will be recreated everytime the window is resized, which would cause leaking in both compositor and client.

Also, region object need to be destroyed after setRegion.

Test with WAYLAND_DEBUG=1 konsole

Before

[2854230.744]  -> org_kde_kwin_blur@157.commit()
[2854238.692]  -> org_kde_kwin_blur_manager@30.create(new id org_kde_kwin_blur@184, wl_surface@29)
[2854238.699]  -> org_kde_kwin_blur@184.set_region(wl_region@185)
[2854238.701]  -> org_kde_kwin_blur@184.commit()
[2854258.075]  -> org_kde_kwin_blur_manager@30.create(new id org_kde_kwin_blur@186, wl_surface@29)
[2854258.083]  -> org_kde_kwin_blur@186.set_region(wl_region@187)
[2854258.085]  -> org_kde_kwin_blur@186.commit()
[2854329.950]  -> org_kde_kwin_blur_manager@30.create(new id org_kde_kwin_blur@183, wl_surface@29)
[2854329.979]  -> org_kde_kwin_blur@183.set_region(wl_region@182)
[2854329.988]  -> org_kde_kwin_blur@183.commit()

After (see how wl_region object id is reused)

[3672110.949]  -> org_kde_kwin_blur@31.set_region(wl_region@52)
[3672110.951]  -> org_kde_kwin_blur@31.commit()
[3672115.326]  -> org_kde_kwin_blur@31.set_region(wl_region@53)
[3672115.328]  -> org_kde_kwin_blur@31.commit()
[3672119.814]  -> org_kde_kwin_blur@31.set_region(wl_region@40)
[3672119.816]  -> org_kde_kwin_blur@31.commit()
[3672127.871]  -> org_kde_kwin_blur@31.set_region(wl_region@54)
[3672127.874]  -> org_kde_kwin_blur@31.commit()
[3672132.715]  -> org_kde_kwin_blur@31.set_region(wl_region@38)
[3672132.718]  -> org_kde_kwin_blur@31.commit()
[3672147.258]  -> org_kde_kwin_blur@31.set_region(wl_region@52)
[3672147.260]  -> org_kde_kwin_blur@31.commit()
[3672208.850]  -> org_kde_kwin_blur@31.set_region(wl_region@53)
[3672208.857]  -> org_kde_kwin_blur@31.commit()
[3672317.025]  -> org_kde_kwin_blur@31.set_region(wl_region@50)
[3672317.036]  -> org_kde_kwin_blur@31.commit()

Merge request reports

Loading