mirror of
https://github.com/swaywm/sway.git
synced 2024-11-16 13:13:17 +00:00
Merge pull request #2547 from RyanDwyer/fix-reload-crash
Fix crash on reload
This commit is contained in:
commit
89a045835f
|
@ -401,3 +401,17 @@ char *argsep(char **stringp, const char *delim) {
|
||||||
found:
|
found:
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *strcasestr(const char *haystack, const char *needle) {
|
||||||
|
size_t needle_len = strlen(needle);
|
||||||
|
const char *pos = haystack;
|
||||||
|
const char *end = pos + strlen(haystack) - needle_len;
|
||||||
|
|
||||||
|
while (pos <= end) {
|
||||||
|
if (strncasecmp(pos, needle, needle_len) == 0) {
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
++pos;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -46,4 +46,6 @@ char *cmdsep(char **stringp, const char *delim);
|
||||||
// Split string into 2 by delim, handle quotes
|
// Split string into 2 by delim, handle quotes
|
||||||
char *argsep(char **stringp, const char *delim);
|
char *argsep(char **stringp, const char *delim);
|
||||||
|
|
||||||
|
const char *strcasestr(const char *haystack, const char *needle);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -310,7 +310,7 @@ void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding)
|
||||||
bool reload = false;
|
bool reload = false;
|
||||||
// if this is a reload command we need to make a duplicate of the
|
// if this is a reload command we need to make a duplicate of the
|
||||||
// binding since it will be gone after the reload has completed.
|
// binding since it will be gone after the reload has completed.
|
||||||
if (strcasecmp(binding->command, "reload") == 0) {
|
if (strcasestr(binding->command, "reload")) {
|
||||||
reload = true;
|
reload = true;
|
||||||
binding_copy = sway_binding_dup(binding);
|
binding_copy = sway_binding_dup(binding);
|
||||||
if (!binding_copy) {
|
if (!binding_copy) {
|
||||||
|
|
Loading…
Reference in a new issue