From patchwork Thu Jul 1 23:07:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12761 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 3010AC3222 for ; Thu, 1 Jul 2021 23:08:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8D1A560288; Fri, 2 Jul 2021 01:08:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hNjX1R4X"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A08AA60288 for ; Fri, 2 Jul 2021 01:08:25 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0FAB54AB; Fri, 2 Jul 2021 01:08:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1625180905; bh=OsuaE2Rg+2VPY3rbkU1MhtqFpwCeoTalyer3M66igqU=; h=From:To:Cc:Subject:Date:From; b=hNjX1R4XaT46IlOVkNOGpQY6n6J+vXHzSWmJBF4xejQQHmQwxNp6nkxv4XvHGvyTM j/k06Kt5+XSXitRAmh5utOAepX9TsWmq8sZEGIzojIlvgaCfW+bJOJMUG/Axlo7pmt bKZrEt1nLWy5KDhGG3m+aDAALpfgnqzQ5SJkcXS4= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 2 Jul 2021 02:07:38 +0300 Message-Id: <20210701230741.14320-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/3] base: Fix crash with recursive messages dispatch X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hello, This patch series fixes a crash related to recursive dispatch of messages, as reported in https://bugs.libcamera.org/show_bug.cgi?id=26. Patch 1/3 is a small drive-by documentation fix. Patch 2/3 adds a test case to trigger the issue, and patch 3/3 fixes it. Please see patch 3/3 for a detailed explanation of the problem and the fix. David, would you be able to check if this fixes the issue you've reported ? Laurent Pinchart (3): base: thread: Document the postMessage() function as thread-safe test: message: Test recursive Thread::dispatchMessages() calls base: thread: Fix recursive calls to dispatchMessages() src/libcamera/base/thread.cpp | 45 ++++++++++++++++++------ test/message.cpp | 66 +++++++++++++++++++++++++++++++++-- 2 files changed, 99 insertions(+), 12 deletions(-)