fix memory leaks and update to new XCB API

SVN revision: 19110
This commit is contained in:
doursse 2005-12-18 11:25:09 +00:00 committed by doursse
parent ce35591227
commit 7a6855c42f
4 changed files with 56 additions and 9 deletions

View File

@ -8,6 +8,20 @@
XCBSCREEN *
get_screen (XCBConnection *c,
int screen)
{
XCBSCREENIter i;
i = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(c));
for (; i.rem; --screen, XCBSCREENNext(&i))
if (screen == 0)
return i.data;
return NULL;
}
XCBVISUALTYPE *
get_visual(XCBConnection *conn,
XCBSCREEN *root)
@ -62,15 +76,16 @@ main(int argc, char **argv)
CARD32 value[6];
/* XClassHint chint; */
SizeHints *szhints;
int screen_nbr;
conn = XCBConnectBasic ();
conn = XCBConnect (NULL, &screen_nbr);
if (!conn)
{
printf("Error: cannot open a connection.\n");
exit(-1);
}
screen = XCBConnSetupSuccessRepRootsIter (XCBGetSetup(conn)).data;
screen = get_screen (conn, screen_nbr);
mask =
XCBCWBackingStore | XCBCWColormap |
@ -244,10 +259,11 @@ main(int argc, char **argv)
case XCBButtonPress: {
XCBButtonPressEvent *ev = (XCBButtonPressEvent *)e;
if (ev->button.id == 3)
if (ev->detail.id == 3)
{
setdown();
evas_free(evas);
free(e);
XCBDisconnect(conn);
evas_shutdown();
exit(0);

View File

@ -19,6 +19,20 @@ Evas *evas = NULL;
int win_w = 240;
int win_h = 240;
XCBSCREEN *
get_screen (XCBConnection *c,
int screen)
{
XCBSCREENIter i;
i = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(c));
for (; i.rem; --screen, XCBSCREENNext(&i))
if (screen == 0)
return i.data;
return NULL;
}
XCBVISUALTYPE *
get_visual(XCBConnection *conn,
XCBSCREEN *root)
@ -72,15 +86,16 @@ main(int argc, char **argv)
CARD32 value[6];
/* XClassHint chint; */
SizeHints *szhints;
int screen_nbr;
c = XCBConnectBasic ();
c = XCBConnect (NULL, &screen_nbr);
if (!c)
{
printf("Error: cannot open a connection.\n");
exit(-1);
}
screen = XCBConnSetupSuccessRepRootsIter (XCBGetSetup(c)).data;
screen = get_screen (c, screen_nbr);
mask = CWBackingStore | CWColormap |
CWBackPixmap | CWBorderPixel |

View File

@ -19,6 +19,20 @@ Evas *evas = NULL;
int win_w = 240;
int win_h = 240;
XCBSCREEN *
get_screen (XCBConnection *c,
int screen)
{
XCBSCREENIter i;
i = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(c));
for (; i.rem; --screen, XCBSCREENNext(&i))
if (screen == 0)
return i.data;
return NULL;
}
XCBVISUALTYPE *
get_visual(XCBConnection *conn,
XCBSCREEN *root)
@ -72,15 +86,16 @@ main(int argc, char **argv)
CARD32 value[6];
/* XClassHint chint; */
SizeHints *szhints;
int screen_nbr;
c = XCBConnectBasic ();
c = XCBConnect (NULL, &screen_nbr);
if (!c)
{
printf("Error: cannot open a connection.\n");
exit(-1);
}
screen = XCBConnSetupSuccessRepRootsIter (XCBGetSetup(c)).data;
screen = get_screen (c, screen_nbr);
mask = CWBackingStore | CWColormap |
CWBackPixmap | CWBorderPixel |

View File

@ -921,6 +921,7 @@ evas_software_xcb_outbuf_perf_restore_x(XCBConnection *conn,
type = type_rep->atom;
format = STRING;
retval = NULL;
free(type_rep);
cookie = XCBGetProperty(conn, 0, perf->x.root.window,
type, format,
@ -942,9 +943,9 @@ evas_software_xcb_outbuf_perf_restore_x(XCBConnection *conn,
evas_software_xcb_outbuf_perf_deserialize_x(perf, s);
free(s);
}
/* FIXME: doesn't seem to be need (from valgrind) */
/* free(retval); */
}
free(prop_rep);
return perf;
}