]> git.sur5r.net Git - i3/i3/blobdiff - testcases/lib/i3test/XTEST.pm
Replace http:// with https:// where applicable
[i3/i3] / testcases / lib / i3test / XTEST.pm
index 9ec083b1aec9d54c04f434a07bdad64c595d9bf1..1ca964b154813d6897f7c43c3b40ab58c187cbb0 100644 (file)
@@ -5,7 +5,9 @@ use strict;
 use warnings;
 use v5.10;
 
-use i3test i3_autostart => 0;
+use Test::More;
+use i3test::Util qw(get_socket_path);
+use lib qw(@abs_top_srcdir@/AnyEvent-I3/blib/lib);
 use AnyEvent::I3;
 use ExtUtils::PkgConfig;
 
@@ -59,6 +61,9 @@ bool inlinec_connect() {
 
     if ((conn = xcb_connect(NULL, &screen)) == NULL ||
         xcb_connection_has_error(conn)) {
+        if (conn != NULL) {
+            xcb_disconnect(conn);
+        }
         fprintf(stderr, "Could not connect to X11\n");
         return false;
     }
@@ -79,6 +84,7 @@ bool inlinec_connect() {
         conn, xcb_xkb_use_extension(conn, XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION), &err);
     if (err != NULL || usereply == NULL) {
         fprintf(stderr, "xcb_xkb_use_extension() failed\n");
+        free(err);
         return false;
     }
     free(usereply);
@@ -91,7 +97,7 @@ bool inlinec_connect() {
 bool set_xkb_group(int group) {
     xcb_generic_error_t *err = NULL;
     // Needs libxcb ≥ 1.11 so that we have the following bug fix:
-    // http://cgit.freedesktop.org/xcb/proto/commit/src/xkb.xml?id=8d7ee5b6ba4cf343f7df70372a3e1f85b82aeed7
+    // https://cgit.freedesktop.org/xcb/proto/commit/src/xkb.xml?id=8d7ee5b6ba4cf343f7df70372a3e1f85b82aeed7
     xcb_void_cookie_t cookie = xcb_xkb_latch_lock_state_checked(
         conn,
         XCB_XKB_ID_USE_CORE_KBD, /* deviceSpec */
@@ -104,6 +110,7 @@ bool set_xkb_group(int group) {
         0);                      /* groupLatch */
     if ((err = xcb_request_check(conn, cookie)) != NULL) {
         fprintf(stderr, "X error code %d\n", err->error_code);
+        free(err);
         return false;
     }
     return true;
@@ -124,6 +131,7 @@ bool xtest_input(int type, int detail, int x, int y) {
         XCB_NONE);        /* deviceid */
     if ((err = xcb_request_check(conn, cookie)) != NULL) {
         fprintf(stderr, "X error code %d\n", err->error_code);
+        free(err);
         return false;
     }