Fix crash when there is no active client

This commit is contained in:
Eldar Yusupov 2024-04-13 18:29:35 +03:00
parent 6e3a57ffd1
commit ac48b764da

View File

@ -1,14 +1,14 @@
From 5994fd10cce0eedf95a89406fae0ff5699d0db77 Mon Sep 17 00:00:00 2001
From 780e5ebcf6decdc8cedb69cf9c93446912903b83 Mon Sep 17 00:00:00 2001
From: Eldar Yusupov <eyusupov@gmail.com>
Date: Sun, 17 Mar 2024 19:12:29 +0300
Subject: [PATCH] Restore correct montior for client when it is reattached
---
dwl.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
dwl.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/dwl.c b/dwl.c
index bf763df..40d03dc 100644
index bf763df..c413be8 100644
--- a/dwl.c
+++ b/dwl.c
@@ -107,6 +107,7 @@ typedef struct {
@ -60,12 +60,19 @@ index bf763df..40d03dc 100644
printstatus();
unset_fullscreen:
@@ -2567,6 +2581,8 @@ tagmon(const Arg *arg)
@@ -2565,8 +2579,14 @@ void
tagmon(const Arg *arg)
{
Client *sel = focustop(selmon);
if (sel)
- if (sel)
+ if (sel) {
setmon(sel, dirtomon(arg->i), 0);
+ free(sel->output);
+ sel->output = strdup(sel->mon->wlr_output->name);
+ free(sel->output);
+ sel->output = strdup(sel->mon->wlr_output->name);
+ if (sel->output == NULL) {
+ die("oom");
+ }
+ }
}
void