mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-09-19 13:52:48 +00:00
fix a use-after-free
Prevent a use-after-free when closing a nested dwl with Ctrl+c. It happened because cleanup() → input_method_relay_finish() frees input_method_relay, and then closemon() → focusclient() → input_method_relay_set_focus() uses relay->surface.
This commit is contained in:
@@ -792,6 +792,7 @@ cleanup(void)
|
|||||||
destroykeyboardgroup(&kb_group->destroy, NULL);
|
destroykeyboardgroup(&kb_group->destroy, NULL);
|
||||||
|
|
||||||
input_method_relay_finish(input_method_relay);
|
input_method_relay_finish(input_method_relay);
|
||||||
|
input_method_relay = NULL;
|
||||||
|
|
||||||
/* If it's not destroyed manually, it will cause a use-after-free of wlr_seat.
|
/* If it's not destroyed manually, it will cause a use-after-free of wlr_seat.
|
||||||
* Destroy it until it's fixed on the wlroots side */
|
* Destroy it until it's fixed on the wlroots side */
|
||||||
|
|||||||
@@ -625,7 +625,7 @@ void
|
|||||||
input_method_relay_set_focus(struct input_method_relay *relay,
|
input_method_relay_set_focus(struct input_method_relay *relay,
|
||||||
struct wlr_surface *surface)
|
struct wlr_surface *surface)
|
||||||
{
|
{
|
||||||
if (relay->focused_surface == surface)
|
if (!relay || relay->focused_surface == surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (relay->focused_surface)
|
if (relay->focused_surface)
|
||||||
|
|||||||
Reference in New Issue
Block a user