Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
spectrwm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1a94af3
)
fix to actually check there is data to copy.
author
David Hill
<dhill@conformal.com>
Thu, 12 Jul 2012 21:11:48 +0000
(17:11 -0400)
committer
Reginald Kennedy
<rk@rejii.com>
Fri, 20 Jul 2012 21:58:32 +0000
(
05:58
+0800)
spectrwm.c
patch
|
blob
|
history
diff --git
a/spectrwm.c
b/spectrwm.c
index
ba61a53
..
408efc2
100644
(file)
--- a/
spectrwm.c
+++ b/
spectrwm.c
@@
-6394,6
+6394,7
@@
manage_window(xcb_window_t id)
int i, ws_idx, border_me = 0;
xcb_atom_t ws_idx_atom = XCB_ATOM_NONE;
char ws_idx_str[SWM_PROPLEN], *prop = NULL;
int i, ws_idx, border_me = 0;
xcb_atom_t ws_idx_atom = XCB_ATOM_NONE;
char ws_idx_str[SWM_PROPLEN], *prop = NULL;
+ size_t proplen;
struct swm_region *r;
const char *errstr;
struct pid_e *p;
struct swm_region *r;
const char *errstr;
struct pid_e *p;
@@
-6449,21
+6450,25
@@
manage_window(xcb_window_t id)
/* Get all the window data in one shot */
ws_idx_atom = get_atom_from_string("_SWM_WS");
/* Get all the window data in one shot */
ws_idx_atom = get_atom_from_string("_SWM_WS");
+ fprintf(stderr, "ws_idx_atom: %d\n", ws_idx_atom);
if (ws_idx_atom) {
gpr = xcb_get_property_reply(conn,
xcb_get_property(conn, False, id, ws_idx_atom,
XCB_ATOM_STRING, 0, SWM_PROPLEN),
NULL);
if (gpr) {
if (ws_idx_atom) {
gpr = xcb_get_property_reply(conn,
xcb_get_property(conn, False, id, ws_idx_atom,
XCB_ATOM_STRING, 0, SWM_PROPLEN),
NULL);
if (gpr) {
- prop = malloc(xcb_get_property_value_length(gpr) + 1);
- if (prop) {
- memcpy(prop, xcb_get_property_value(gpr),
- xcb_get_property_value_length(gpr));
- prop[xcb_get_property_value_length(gpr)] = '\0';
+ proplen = xcb_get_property_value_length(gpr);
+ if (proplen > 0) {
+ prop = malloc(proplen + 1);
+ if (prop) {
+ memcpy(prop,
+ xcb_get_property_value(gpr),
+ proplen);
+ prop[proplen] = '\0';
+ }
}
free(gpr);
}
}
free(gpr);
}
-
}
win->wa = xcb_get_geometry_reply(conn,
xcb_get_geometry(conn, id),
}
win->wa = xcb_get_geometry_reply(conn,
xcb_get_geometry(conn, id),