mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
Bug fix #61: Silence a warning
- Silence a FORTIFY_SOURCE warning. Thanks to @smlx for reporting. - Add -O2 -D_FORTIFY_SOURCE=2 to default CFLAGS in Makefile. - Use a cleaner way to resolve the writing-to-freed-memory issue mentioned in last commit.
This commit is contained in:
parent
dc04a7d8ca
commit
b15d40ec09
2 changed files with 13 additions and 13 deletions
2
Makefile
2
Makefile
|
@ -38,7 +38,7 @@ ifeq "$(NO_VSYNC_OPENGL)" ""
|
|||
LIBS += -lGL
|
||||
endif
|
||||
|
||||
CFLAGS ?= -DNDEBUG
|
||||
CFLAGS ?= -DNDEBUG -O2 -D_FORTIFY_SOURCE=2
|
||||
CFLAGS += $(CFG)
|
||||
|
||||
LIBS += $(shell pkg-config --libs $(PACKAGES))
|
||||
|
|
|
@ -1526,21 +1526,19 @@ paint_preprocess(Display *dpy, win *list) {
|
|||
}
|
||||
|
||||
|
||||
// Avoid setting w->to_paint if w is to be freed
|
||||
bool destroyed = (w->opacity_tgt == w->opacity && w->destroyed);
|
||||
|
||||
if (to_paint) {
|
||||
w->prev_trans = t;
|
||||
t = w;
|
||||
w->to_paint = to_paint;
|
||||
}
|
||||
else {
|
||||
// Avoid setting w->to_paint if w is to be freed
|
||||
if (!(w->opacity_tgt == w->opacity && w->destroyed)) {
|
||||
check_fade_fin(dpy, w);
|
||||
w->to_paint = to_paint;
|
||||
}
|
||||
else {
|
||||
check_fade_fin(dpy, w);
|
||||
}
|
||||
check_fade_fin(dpy, w);
|
||||
}
|
||||
|
||||
if (!destroyed)
|
||||
w->to_paint = to_paint;
|
||||
}
|
||||
|
||||
return t;
|
||||
|
@ -3567,9 +3565,11 @@ fork_after(void) {
|
|||
|
||||
setsid();
|
||||
|
||||
freopen("/dev/null", "r", stdin);
|
||||
freopen("/dev/null", "w", stdout);
|
||||
freopen("/dev/null", "w", stderr);
|
||||
// Mainly to suppress the _FORTIFY_SOURCE warning
|
||||
if (!freopen("/dev/null", "r", stdin)
|
||||
|| !freopen("/dev/null", "w", stdout)
|
||||
|| !freopen("/dev/null", "w", stderr))
|
||||
fprintf(stderr, "fork_after(): freopen() failed.");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LIBCONFIG
|
||||
|
|
Loading…
Reference in a new issue