Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Mar 2014 20:20:59 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r348376 - in head/x11-wm/i3: . files
Message-ID:  <201403152020.s2FKKxiU062983@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Sat Mar 15 20:20:58 2014
New Revision: 348376
URL: http://svnweb.freebsd.org/changeset/ports/348376
QAT: https://qat.redports.org/buildarchive/r348376/

Log:
  - Fixes resourceleak in i3bar and memoryleak in i3
  - Convert to USES=tar:bzip2
  
  PR:		ports/187617
  Submitted by:	Johannes Jost Meixner <xmj@chaot.net>
  Obtained from:	i3 git (http://code.stapelberg.de/git/i3/)

Added:
  head/x11-wm/i3/files/
  head/x11-wm/i3/files/patch-memory-leak   (contents, props changed)
Modified:
  head/x11-wm/i3/Makefile

Modified: head/x11-wm/i3/Makefile
==============================================================================
--- head/x11-wm/i3/Makefile	Sat Mar 15 19:53:01 2014	(r348375)
+++ head/x11-wm/i3/Makefile	Sat Mar 15 20:20:58 2014	(r348376)
@@ -3,6 +3,7 @@
 
 PORTNAME=	i3
 DISTVERSION=	4.7.2
+PORTREVISION=	1
 CATEGORIES=	x11-wm
 MASTER_SITES=	http://i3wm.org/downloads/
 
@@ -20,14 +21,13 @@ LIB_DEPENDS=	libstartup-notification-1.s
 		libcairo.so:${PORTSDIR}/graphics/cairo \
 		libpangocairo-1.0.so:${PORTSDIR}/x11-toolkits/pango \
 		libpcre.so:${PORTSDIR}/devel/pcre \
-		libxcb-cursor.so.0:${PORTSDIR}/x11/xcb-util-cursor
+		libxcb-cursor.so:${PORTSDIR}/x11/xcb-util-cursor
 RUN_DEPENDS=	p5-IPC-Run>=0:${PORTSDIR}/devel/p5-IPC-Run \
 		p5-Try-Tiny>=0:${PORTSDIR}/lang/p5-Try-Tiny \
 		p5-AnyEvent-I3>=0:${PORTSDIR}/devel/p5-AnyEvent-I3
 
 USE_XORG=	x11 xcb
-USES=		pkgconfig iconv gmake perl5
-USE_BZIP2=	yes
+USES=		pkgconfig iconv gmake perl5 tar:bzip2
 USE_PERL5=	run
 LDFLAGS+=	-L${LOCALBASE}/lib ${ICONV_LIB}
 MAKE_JOBS_UNSAFE=	yes
@@ -55,5 +55,4 @@ post-install:
 		${STAGEDIR}${PREFIX}/bin/i3-nagbar \
 		${STAGEDIR}${PREFIX}/bin/i3-dump-log
 
-
 .include <bsd.port.mk>

Added: head/x11-wm/i3/files/patch-memory-leak
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11-wm/i3/files/patch-memory-leak	Sat Mar 15 20:20:58 2014	(r348376)
@@ -0,0 +1,110 @@
+--- i3bar/src/xcb.c
++++ /i3bar/src/xcb.c
+@@ -1395,8 +1395,8 @@ void realloc_sl_buffer(void) {
+ 
+     mask |= XCB_GC_BACKGROUND;
+     vals[0] = colors.bar_fg;
+-    statusline_ctx = xcb_generate_id(xcb_connection);
+     xcb_free_gc(xcb_connection, statusline_ctx);
++    statusline_ctx = xcb_generate_id(xcb_connection);
+     xcb_void_cookie_t sl_ctx_cookie = xcb_create_gc_checked(xcb_connection,
+                                                             statusline_ctx,
+                                                             xcb_root,
+--- src/commands.c
++++ src/commands.c
+@@ -779,6 +779,12 @@ void cmd_resize(I3_CMD, char *way, char *direction, char *resize_px, char *resiz
+ 
+     owindow *current;
+     TAILQ_FOREACH(current, &owindows, owindows) {
++        /* Don't handle dock windows (issue #1201) */
++        if (current->con->window->dock) {
++            DLOG("This is a dock window. Not resizing (con = %p)\n)", current->con);
++            continue;
++        }
++
+         Con *floating_con;
+         if ((floating_con = con_inside_floating(current->con))) {
+             cmd_resize_floating(current_match, cmd_output, way, direction, floating_con, px);
+--- src/ipc.c
++++ src/ipc.c
+@@ -833,14 +833,16 @@ handler_t handlers[8] = {
+ static void ipc_receive_message(EV_P_ struct ev_io *w, int revents) {
+     uint32_t message_type;
+     uint32_t message_length;
+-    uint8_t *message;
++    uint8_t *message = NULL;
+ 
+     int ret = ipc_recv_message(w->fd, &message_type, &message_length, &message);
+     /* EOF or other error */
+     if (ret < 0) {
+         /* Was this a spurious read? See ev(3) */
+-        if (ret == -1 && errno == EAGAIN)
++        if (ret == -1 && errno == EAGAIN) {
++            FREE(message);
+             return;
++        }
+ 
+         /* If not, there was some kind of error. We don’t bother
+          * and close the connection */
+@@ -863,6 +865,7 @@ static void ipc_receive_message(EV_P_ struct ev_io *w, int revents) {
+ 
+         ev_io_stop(EV_A_ w);
+         free(w);
++        FREE(message);
+ 
+         DLOG("IPC: client disconnected\n");
+         return;
+@@ -874,6 +877,8 @@ static void ipc_receive_message(EV_P_ struct ev_io *w, int revents) {
+         handler_t h = handlers[message_type];
+         h(w->fd, message, 0, message_length, message_type);
+     }
++
++    FREE(message);
+ }
+ 
+ /*
+--- dev/null
++++ testcases/t/222-regress-dock-resize.t
+@@ -0,0 +1,42 @@
++#!perl
++# vim:ts=4:sw=4:expandtab
++#
++# Please read the following documents before working on tests:
++# • http://build.i3wm.org/docs/testsuite.html
++#   (or docs/testsuite)
++#
++# • http://build.i3wm.org/docs/lib-i3test.html
++#   (alternatively: perldoc ./testcases/lib/i3test.pm)
++#
++# • http://build.i3wm.org/docs/ipc.html
++#   (or docs/ipc)
++#
++# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
++#   (unless you are already familiar with Perl)
++#
++# Test that i3 does not crash when a command is issued that would resize a dock
++# client.
++# Ticket: #1201
++# Bug still in: 4.7.2-107-g9b03be6
++use i3test i3_autostart => 0;
++
++my $config = <<'EOT';
++# i3 config file (v4)
++font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
++EOT
++
++my $pid = launch_with_config($config);
++
++my $i3 = i3(get_socket_path());
++$i3->connect()->recv;
++
++my $window = open_window(
++    wm_class => 'special',
++    window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
++);
++
++cmd('[class="special"] resize grow height 160 px or 16 ppt');
++
++does_i3_live;
++
++done_testing;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403152020.s2FKKxiU062983>