mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-25 09:34:11 +00:00
- 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/)
This commit is contained in:
parent
1690a40002
commit
d84e12f791
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=348376
@ -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.so:${PORTSDIR}/x11/startup-notification \
|
||||
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>
|
||||
|
110
x11-wm/i3/files/patch-memory-leak
Normal file
110
x11-wm/i3/files/patch-memory-leak
Normal file
@ -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;
|
Loading…
Reference in New Issue
Block a user