From patchwork Tue Feb 22 17:06:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 545050 Delivered-To: patch@linaro.org Received: by 2002:ac0:e142:0:0:0:0:0 with SMTP id r2csp18632imn; Tue, 22 Feb 2022 09:10:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbiE2CzYb5wqKZHe9/ahmy0e8Dd4Zuon+voYrnJ46Ou7M2ePxPIFWerEwLfH4gVX6SobVm X-Received: by 2002:a05:622a:1654:b0:2d1:83d6:ea64 with SMTP id y20-20020a05622a165400b002d183d6ea64mr23021664qtj.599.1645549824884; Tue, 22 Feb 2022 09:10:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645549824; cv=none; d=google.com; s=arc-20160816; b=QUbpJRgaRYcxr2Uh90zZ2YYnGG3+ZB4O3koKpBrl2qiLu9duVUcnUajXLfyejvW0Xn +YH2VaH7CmeEtY2wTh6KcPk8ql3wqapwiO2thbiU507SsIYMx45Ae5N5kgTWdu7NashA ezuL9IWM3DWiFeFk0G3+KKBv2c5P8pACE+uYxAHP7qtoECyHobHSB5ngdxMF4kSjohvq eEJLY8gfpzeU/5qS3Sxgyv12/s8F5L71V1wc2+hy1b0fBjJasL3EhgtCA5DLoR9Amtob xVjlmcnwK2jXS8VApRMDznJErjLFbMAkABhnoidEGRQnp5PqLDszXVtm9vwEBbhYxGLT SO6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=v4QWuB/UtXQh+ieQ/jNh6PJp6YckfgfBwGNcqYRWs2I=; b=VvfMKzuyXfQ1TI1AATKPx/wGCINEzS341EaTamdDnIObA5NhFm6evTZu0VL3Fy3rr9 afjNel5X0V1DldCLTWKKDuqkhrMEdz2gulgD5IMBqYF+n0bKXNctKozxHf3tnR/JQj87 ICyC6rhyisuAN85N91JZw8mAXkB+9ZcUoH0UHVxaM01yyouH04NuXm/D1qd+M4zW2QmE cd4F6y/qqRklPu96iYZOTpgJvYOCkoJImDBqnNEI1QR0sLqtD5ZPhEvhzrdAVIGEWMU4 4P0Yzvx3bBxHovqAvGbhB17/l0/M1NzivcKnepQxPSmCRzQQY2PXrBSloBiuyrciLM6q /l0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ltr2wsw6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g20si133512qkp.420.2022.02.22.09.10.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Feb 2022 09:10:24 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ltr2wsw6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMYgB-0005tK-8s for patch@linaro.org; Tue, 22 Feb 2022 12:10:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMYcn-0002Ck-44 for qemu-devel@nongnu.org; Tue, 22 Feb 2022 12:06:53 -0500 Received: from [2a00:1450:4864:20::32a] (port=46695 helo=mail-wm1-x32a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nMYcl-0005Lb-1M for qemu-devel@nongnu.org; Tue, 22 Feb 2022 12:06:52 -0500 Received: by mail-wm1-x32a.google.com with SMTP id p184-20020a1c29c1000000b0037f76d8b484so2350503wmp.5 for ; Tue, 22 Feb 2022 09:06:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v4QWuB/UtXQh+ieQ/jNh6PJp6YckfgfBwGNcqYRWs2I=; b=Ltr2wsw6oofF9T/BROXMRAfysZNx3uCAzNXtdYRWoiD3Aery6eTEZx0KuAhV0KiyIj 2X4vVL7fx/mug2egGgU3FJ9iqB6ipE+lNa52LpEVq3SSAD31Q+hbe2qokl9Cf4YS6/bf wqztcZpLA4MM4l5AkFs/lihfMCc/zVaAvBOXBHgD6VqyciptRzZI0aLUFSI8cPsuahPV /MRHBwMyBfx+yBYyWmv51vy4ZCVHO6fbweo/H09b2Sxseg9afzCOXAKotbOPnUqbdDRA 8BxgVWqWnwa+zOUJSffu8kf4CMCSkxVyf4aeA9WUvRl/jiMQaF/dgQVw8by+NUuUg/It yIDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v4QWuB/UtXQh+ieQ/jNh6PJp6YckfgfBwGNcqYRWs2I=; b=3/Q6qSqOq53anrvrdxRcX49U5RIr6VIUu9MGyhFKNB95wIaB6uiPcTFgSrIQhNCFI3 a0gpXweqzZWNCHx4B0kZdsmwwKnSPDI1/y98f0oqrR6HHOcBUtEGX7QHV0IPsjYimKKq 4H80P2c5222czzIEALV8abKJkttg0XtRdHlmMFZ9R1xWjZMDlhozgF/9q7zuF26Kn+hw oauNuBCFigIbIqlv6JV1Yd15XPoGvTU2WmQPzvvdfLLLQ8CbAEVQRpLGlMlHgx33Rz4B 23+JfCz3o8iTzUrVi6Jv9FzRvS3AedSQMCEqjLJfspCSis5c4jOkpr9ZIetQNi2euD89 zj3Q== X-Gm-Message-State: AOAM532DTBK3ZwDplVTDWecMz+HiXAAZboXegylmAlevIyHZhCNTrjx5 oPKKyNsnatiV4gZ58GK2ohuP7MGfWeQqXw== X-Received: by 2002:a1c:6a16:0:b0:37b:f4b0:65d8 with SMTP id f22-20020a1c6a16000000b0037bf4b065d8mr4151481wmc.80.1645549609233; Tue, 22 Feb 2022 09:06:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id l10-20020a7bc44a000000b0037c32873258sm2813113wmi.2.2022.02.22.09.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 09:06:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH 1/2] ui/cocoa.m: Fix updateUIInfo threading issues Date: Tue, 22 Feb 2022 17:06:44 +0000 Message-Id: <20220222170645.860661-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220222170645.860661-1-peter.maydell@linaro.org> References: <20220222170645.860661-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32a (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The updateUIInfo method makes Cocoa API calls. It also calls back into QEMU functions like dpy_set_ui_info(). To do this safely, we need to follow two rules: * Cocoa API calls are made on the Cocoa UI thread * When calling back into QEMU we must hold the iothread lock Fix the places where we got this wrong, by taking the iothread lock while executing updateUIInfo, and moving the call in cocoa_switch() inside the dispatch_async block. Some of the Cocoa UI methods which call updateUIInfo are invoked as part of the initial application startup, while we're still doing the little cross-thread dance described in the comment just above call_qemu_main(). This meant they were calling back into the QEMU UI layer before we'd actually finished initializing our display and registered the DisplayChangeListener, which isn't really valid. Once updateUIInfo takes the iothread lock, we no longer get away with this, because during this startup phase the iothread lock is held by the QEMU main-loop thread which is waiting for us to finish our display initialization. So we must suppress updateUIInfo until applicationDidFinishLaunching allows the QEMU main-loop thread to continue, and instead defer telling the UI layer about our initial window size until later. Signed-off-by: Peter Maydell --- ui/cocoa.m | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index a8f1cdaf926..f8d3d8ad7a6 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -522,8 +522,9 @@ QemuCocoaView *cocoaView; } } -- (void) updateUIInfo +- (void) doUpdateUIInfo { + /* Must be called with the iothread lock, i.e. via updateUIInfo */ NSSize frameSize; QemuUIInfo info; @@ -554,6 +555,22 @@ QemuCocoaView *cocoaView; dpy_set_ui_info(dcl.con, &info, TRUE); } +- (void) updateUIInfo +{ + if (!allow_events) { + /* + * Don't try to tell QEMU about UI information in the application + * startup phase -- we haven't yet registered dcl with the QEMU UI + * layer, and also trying to take the iothread lock would deadlock. + */ + return; + } + + with_iothread_lock(^{ + [self doUpdateUIInfo]; + }); +} + - (void)viewDidMoveToWindow { [self updateUIInfo]; @@ -1985,8 +2002,6 @@ static void cocoa_switch(DisplayChangeListener *dcl, COCOA_DEBUG("qemu_cocoa: cocoa_switch\n"); - [cocoaView updateUIInfo]; - // The DisplaySurface will be freed as soon as this callback returns. // We take a reference to the underlying pixman image here so it does // not disappear from under our feet; the switchSurface method will @@ -1994,6 +2009,7 @@ static void cocoa_switch(DisplayChangeListener *dcl, pixman_image_ref(image); dispatch_async(dispatch_get_main_queue(), ^{ + [cocoaView updateUIInfo]; [cocoaView switchSurface:image]; }); [pool release]; @@ -2057,6 +2073,11 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) qemu_event_init(&cbevent, false); cbowner = [[QemuCocoaPasteboardTypeOwner alloc] init]; qemu_clipboard_peer_register(&cbpeer); + + /* Now we're set up, tell the UI layer our initial window size */ + dispatch_async(dispatch_get_main_queue(), ^{ + [cocoaView updateUIInfo]; + }); } static QemuDisplay qemu_display_cocoa = { From patchwork Tue Feb 22 17:06:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 545051 Delivered-To: patch@linaro.org Received: by 2002:ac0:e142:0:0:0:0:0 with SMTP id r2csp19406imn; Tue, 22 Feb 2022 09:11:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWYd/ESBlkOCRkDuDYLzPC+WgvRLWwEtHgQfi+2i15izKtkU/b6z20k0tnEH9b+tjvM0h2 X-Received: by 2002:ad4:472b:0:b0:432:4f1d:a85e with SMTP id l11-20020ad4472b000000b004324f1da85emr1766774qvz.15.1645549882017; Tue, 22 Feb 2022 09:11:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645549882; cv=none; d=google.com; s=arc-20160816; b=cP2SaTwOP6SfIh0vKC5HeOgheCiVWdz+LzxvuN9ORtOUSegnj43wUv91h5CCF/koMY DSCMtGXP3tb/fktlsij6g6A6785AkW3m0XGh5IO+8bi6n307va10uUXjQFXOZ6zA3OEY cZFESCYG04D8GCnug/Rk1yd0YU7jbCTjrg1NYfV/NMjmyBmBOFZSYBtX/0fLTMwEDJi9 5xZCO+jvnl5NkXl17r1N+lxZaWJCs6jOTL5Yzlz9aiVzW8LMB5c6jJ50+M3IuXGyzibz g8kOPTPUkYc6Y0hVreGRf2w1aOe3Vac+bVtAc3MODe6DiUNCt2AUgDQV2AoOGekrjFBg ehXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=L1Rz4znL/F3W1cisPkd39hXPuRmoy9F32ffLPy9BqWU=; b=CMxVXH3mBc0MI/eEQ9A1w5xCjWTiLyd/xb+MgK0a5kJzkxcmARLwinH0/KttG87rEY EVNua6E97bUzT+MMTwp7Fygnbf2Lx/R9PPCo8DKwuvlqTHb6b3GYTRlOTiJqm6++NRsJ RFpHen8aXbdMhhvf9qHk78FeyJDoHnWbYMvkkT2slZN+tgKywuEFkC3tlbIT+jR+MbND 6I0BWBXZBJj9OJC5lK3Ra8HaDwpv8VQNvRY5KNmJq5E21MHYjX59pfMQPyhvXiCpXQ4R ph7XHQU9NA0aSsS5h7HZ1cukxOiOAC1FjDXz12LZG0ABxGQL9aZwjM6NAChosTL+9bvk zfgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tCvywHtu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 10si150332qtz.199.2022.02.22.09.11.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Feb 2022 09:11:22 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tCvywHtu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMYh7-0007ZX-GF for patch@linaro.org; Tue, 22 Feb 2022 12:11:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMYco-0002FE-8V for qemu-devel@nongnu.org; Tue, 22 Feb 2022 12:06:54 -0500 Received: from [2a00:1450:4864:20::333] (port=52819 helo=mail-wm1-x333.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nMYcl-0005Ll-FM for qemu-devel@nongnu.org; Tue, 22 Feb 2022 12:06:53 -0500 Received: by mail-wm1-x333.google.com with SMTP id w13so11515300wmi.2 for ; Tue, 22 Feb 2022 09:06:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L1Rz4znL/F3W1cisPkd39hXPuRmoy9F32ffLPy9BqWU=; b=tCvywHtuwPAb7EJWKjFhZHmGRfxlGTpJTcUBPz5OjyHQdS5KGIobdad96qiWYgW/TH qZoJXDgyBD5dF12ufWA/JZ4H4pdiiBxfL/BIySxOyu9Jrzp0TgxD4xLEzbPDyiKS+EZw Y5Kh7J3XbS7ruxi6SA+g5HFLAoASJuHfxcDRkU1Qbe+9dxYGMWTRQRnVRYdFm822iXyG P3pXWI9euXlR3SuH1Gjp1XICDYxpw4QilCHctQCTBHWV9gdV1yopcK6xMfAaj39L2/U4 LJ9XnOv+C8urj8T2OFbBs3jq4bL3KHkNc1//ZHrOEfLxNB8p+4xs5+s8B6FqzO2mJ42F llJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L1Rz4znL/F3W1cisPkd39hXPuRmoy9F32ffLPy9BqWU=; b=AJucZHi1ZtnzVSJMYVHSc9oEo67NV9QgNzNA6KQ03TK7UPFrpvvfwaeOQ0lV+UXeff PffRJyKbu9BGRdFzG+JTdIUCYtjkf12SuEpUaTCHkvVcwT6watQ59NLYKXBM3B8s87Y8 lFvXlI9ZrZoQk/BJYhNj/NOiO/IeSpuDklaf3wKlIhSpZ2g7mwRpOd2MAp6yPVwPner8 QpqvqX5P8UwNSExo9uHR8tnD9C80+AgmqGrpFof8MQIltoCxUvXUACaN+iH7ZjHbCX3t bCbTTTOw+ExZxJ+EJUFxJ5eZemMLdRafXnyJBZ2AFBcOwWF/bMR7PCIY+4LwkMHxrI84 NxRg== X-Gm-Message-State: AOAM5316tPeWBMX62yBsyhEn9Mo8OEpMthgCncOR+e9J5LS1+QWjVvK+ o33vvfzkFUS7sP5tKUhfUgsl1iZyIwZ3iQ== X-Received: by 2002:a05:600c:4c27:b0:37b:fa17:899a with SMTP id d39-20020a05600c4c2700b0037bfa17899amr4112933wmp.126.1645549610126; Tue, 22 Feb 2022 09:06:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id l10-20020a7bc44a000000b0037c32873258sm2813113wmi.2.2022.02.22.09.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 09:06:49 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH 2/2] ui/cocoa.m: Remove unnecessary NSAutoreleasePools Date: Tue, 22 Feb 2022 17:06:45 +0000 Message-Id: <20220222170645.860661-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220222170645.860661-1-peter.maydell@linaro.org> References: <20220222170645.860661-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::333 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In commit 6e657e64cdc478 in 2013 we added some autorelease pools to deal with complaints from macOS when we made calls into Cocoa from threads that didn't have automatically created autorelease pools. Later on, macOS got stricter about forbidding cross-thread Cocoa calls, and in commit 5588840ff77800e839d8 we restructured the code to avoid them. This left the autorelease pool creation in several functions without any purpose; delete it. We still need the pool in cocoa_refresh() for the clipboard related code which is called directly there. Signed-off-by: Peter Maydell --- ui/cocoa.m | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index f8d3d8ad7a6..ea8084cda86 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1973,8 +1973,6 @@ int main (int argc, char **argv) { static void cocoa_update(DisplayChangeListener *dcl, int x, int y, int w, int h) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - COCOA_DEBUG("qemu_cocoa: cocoa_update\n"); dispatch_async(dispatch_get_main_queue(), ^{ @@ -1990,14 +1988,11 @@ static void cocoa_update(DisplayChangeListener *dcl, } [cocoaView setNeedsDisplayInRect:rect]; }); - - [pool release]; } static void cocoa_switch(DisplayChangeListener *dcl, DisplaySurface *surface) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; pixman_image_t *image = surface->image; COCOA_DEBUG("qemu_cocoa: cocoa_switch\n"); @@ -2012,7 +2007,6 @@ static void cocoa_switch(DisplayChangeListener *dcl, [cocoaView updateUIInfo]; [cocoaView switchSurface:image]; }); - [pool release]; } static void cocoa_refresh(DisplayChangeListener *dcl)