[wiki] [sites] fix: segfault when there is something in selid and no item is selected || bit9tream
commit a7a434ff80cfeb4442afa9ea0d93b528acb4cb12
Author: bit9tream <bit6tream_AT_cock.li>
Date: Fri Jun 12 11:46:52 2020 +0300
fix: segfault when there is something in selid and no item is selected
diff --git a/tools.suckless.org/dmenu/patches/multi-selection/dmenu-multi-selection-4.9.diff b/tools.suckless.org/dmenu/patches/multi-selection/dmenu-multi-selection-4.9.diff
index 56312e3d..dffc70da 100644
--- a/tools.suckless.org/dmenu/patches/multi-selection/dmenu-multi-selection-4.9.diff
+++ b/tools.suckless.org/dmenu/patches/multi-selection/dmenu-multi-selection-4.9.diff
_AT_@ -1,5 +1,5 @@
diff --git a/dmenu.c b/dmenu.c
-index 6b8f51b..b621ce3 100644
+index 6b8f51b..6544112 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -31,7 +31,8 @@ enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
_AT_@ -55,16 +55,14 @@ index 6b8f51b..b621ce3 100644
drw_setscheme(drw, scheme[SchemeOut]);
else
drw_setscheme(drw, scheme[SchemeNorm]);
-_AT_@ -367,6 +381,22 @@ keypress(XKeyEvent *ev)
+_AT_@ -367,6 +381,20 @@ keypress(XKeyEvent *ev)
goto draw;
case XK_Return:
case XK_KP_Enter:
-+ if (!sel) return;
-+ if (issel(sel->id)) {
++ if (sel && issel(sel->id)) {
+ for (int i = 0;i < selidsize;i++)
+ if (selid[i] == sel->id)
+ selid[i] = -1;
-+ return;
+ } else {
+ for (int i = 0;i < selidsize;i++)
+ if (selid[i] == -1) {
_AT_@ -78,14 +76,14 @@ index 6b8f51b..b621ce3 100644
break;
case XK_bracketleft:
cleanup();
-_AT_@ -464,13 +494,17 @@ insert:
+_AT_@ -464,13 +492,17 @@ insert:
break;
case XK_Return:
case XK_KP_Enter:
- puts((sel && !(ev->state & ShiftMask)) ? sel->text : text);
if (!(ev->state & ControlMask)) {
+ for (int i = 0;i < selidsize;i++)
-+ if (selid[i] != -1 && sel->id != selid[i])
++ if (selid[i] != -1 && (!sel || sel->id != selid[i]))
+ puts(items[selid[i]].text);
+ if (sel && !(ev->state & ShiftMask))
+ puts(sel->text);
_AT_@ -99,7 +97,7 @@ index 6b8f51b..b621ce3 100644
break;
case XK_Right:
if (text[cursor] != '-_AT_@ -534,7 +568,7 @@ readstdin(void)
+_AT_@ -534,7 +566,7 @@ readstdin(void)
*p = ' if (!(items[i].text = strdup(buf)))
die("cannot strdup %u bytes:", strlen(buf) + 1);
Received on Fri Jun 12 2020 - 10:47:47 CEST
This archive was generated by hypermail 2.3.0
: Fri Jun 12 2020 - 10:48:46 CEST