{"id":2221110,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2221110/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260408010026.4611-4-matt@matthewpenney.net/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.1/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260408010026.4611-4-matt@matthewpenney.net>","date":"2026-04-08T01:02:20","name":"[3/8] io: use g_clear_handle_id() for GSource cleanup","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a101147cbbeb998bd2196b0a20265762dfb93e6f","submitter":{"id":92789,"url":"http://patchwork.ozlabs.org/api/1.1/people/92789/?format=json","name":"Matthew Penney","email":"matt@matthewpenney.net"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260408010026.4611-4-matt@matthewpenney.net/mbox/","series":[{"id":499175,"url":"http://patchwork.ozlabs.org/api/1.1/series/499175/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499175","date":"2026-04-08T01:02:28","name":"[1/8] hw/char: use g_clear_handle_id() for GSource cleanup","version":1,"mbox":"http://patchwork.ozlabs.org/series/499175/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221110/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221110/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=matthewpenney.net header.i=@matthewpenney.net\n header.a=rsa-sha256 header.s=protonmail header.b=faDerZWt;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frXmT6Zdmz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 05:14:01 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wAYKw-0004s0-R8; Wed, 08 Apr 2026 15:13:25 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <matt@matthewpenney.net>)\n id 1wAYJa-0000f1-Nk\n for qemu-devel@nongnu.org; Wed, 08 Apr 2026 15:11:51 -0400","from mail-08.mail-europe.com ([57.129.93.249])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <matt@matthewpenney.net>)\n id 1wAHJP-0001MP-MA\n for qemu-devel@nongnu.org; Tue, 07 Apr 2026 21:02:33 -0400"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=matthewpenney.net;\n s=protonmail; t=1775610143; x=1775869343;\n bh=6Ir9wkbsRzDHn4ZCMkPGCiaAbY7a7WO1QuXJPohGOBE=;\n h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date:\n Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector;\n b=faDerZWtCl+lq5qYekMywp3zEClp7Hdyzkv/yNyGYcIjSUR9GgOQwLxRBhtOCaJ+m\n KcHCde7NeKqn/ZHNL040rMQPeNMt1m1ecExWGYtlzYjhHIesNRXLnNoOG6rZ5pm/0X\n uZQekYJKw2Xb/hEX/nYn7nhOgjGZandORi2AXuT2lwjvChs9KgKi8KzvDUBiGC8Uz6\n rClOcNYRxUdJtMMjPUQnktnftvWmTsyB7TmQK1BIXFAYX3AOuGfrZsL8BnHiMEz700\n Tl1/w6DNApXQPRrwgfK5drSbeabNOf2899nIVeIU1OLiRfLYGTRHDjaeb6Xc8PJ6+V\n 3S8TT6LMHEbSw==","Date":"Wed, 08 Apr 2026 01:02:20 +0000","To":"qemu-devel@nongnu.org","From":"Matthew Penney <matt@matthewpenney.net>","Cc":"Matthew Penney <matt@matthewpenney.net>, =?utf-8?q?Daniel_P=2E_Berrang?=\n\t=?utf-8?q?=C3=A9?= <berrange@redhat.com>","Subject":"[PATCH 3/8] io: use g_clear_handle_id() for GSource cleanup","Message-ID":"<20260408010026.4611-4-matt@matthewpenney.net>","Feedback-ID":"185185778:user:proton","X-Pm-Message-ID":"7b59dc3fac1364fc5b44b65cb830ce258b38207f","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","Received-SPF":"pass client-ip=57.129.93.249;\n envelope-from=matt@matthewpenney.net; helo=mail-08.mail-europe.com","X-Spam_score_int":"-27","X-Spam_score":"-2.8","X-Spam_bar":"--","X-Spam_report":"(-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"Use g_clear_handle_id() instead of g_source_remove() with manual ID\nchecking and zeroing.\n\nThis simplifies the code and ensures consistent handling of GSource IDs,\nsince g_clear_handle_id() checks for a non-zero ID before calling the\ncleanup function and zeros it afterwards.\n\nNo functional change intended.\n\nSigned-off-by: Matthew Penney <matt@matthewpenney.net>\n---\n io/channel-websock.c | 21 +++++----------------\n 1 file changed, 5 insertions(+), 16 deletions(-)","diff":"diff --git a/io/channel-websock.c b/io/channel-websock.c\nindex 9902b014f7..3479a5c32d 100644\n--- a/io/channel-websock.c\n+++ b/io/channel-websock.c\n@@ -950,12 +950,8 @@ static void qio_channel_websock_finalize(Object *obj)\n     buffer_free(&ioc->encinput);\n     buffer_free(&ioc->encoutput);\n     buffer_free(&ioc->rawinput);\n-    if (ioc->hs_io_tag) {\n-        g_source_remove(ioc->hs_io_tag);\n-    }\n-    if (ioc->io_tag) {\n-        g_source_remove(ioc->io_tag);\n-    }\n+    g_clear_handle_id(&ioc->hs_io_tag, g_source_remove);\n+    g_clear_handle_id(&ioc->io_tag, g_source_remove);\n     error_free(ioc->io_err);\n     object_unref(OBJECT(ioc->master));\n }\n@@ -1070,10 +1066,7 @@ static gboolean qio_channel_websock_flush(QIOChannel *ioc,\n \n static void qio_channel_websock_unset_watch(QIOChannelWebsock *ioc)\n {\n-    if (ioc->io_tag) {\n-        g_source_remove(ioc->io_tag);\n-        ioc->io_tag = 0;\n-    }\n+    g_clear_handle_id(&ioc->io_tag, g_source_remove);\n }\n \n static void qio_channel_websock_set_watch(QIOChannelWebsock *ioc)\n@@ -1250,12 +1243,8 @@ static int qio_channel_websock_close(QIOChannel *ioc,\n     buffer_free(&wioc->encinput);\n     buffer_free(&wioc->encoutput);\n     buffer_free(&wioc->rawinput);\n-    if (wioc->hs_io_tag) {\n-        g_clear_handle_id(&wioc->hs_io_tag, g_source_remove);\n-    }\n-    if (wioc->io_tag) {\n-        g_clear_handle_id(&wioc->io_tag, g_source_remove);\n-    }\n+    g_clear_handle_id(&wioc->hs_io_tag, g_source_remove);\n+    g_clear_handle_id(&wioc->io_tag, g_source_remove);\n     if (wioc->io_err) {\n         g_clear_pointer(&wioc->io_err, error_free);\n     }\n","prefixes":["3/8"]}