From patchwork Sat Aug 17 15:21:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1836 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5A8CE61934 for ; Sat, 17 Aug 2019 17:21:19 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 01CDFF78 for ; Sat, 17 Aug 2019 17:21:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1566055279; bh=UQEeFbjsRyzTjI4NOmwfwPm9jZVVigWClodH2XNZflQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=D4ZarYxd7s+Z39rJHpOJrEsMqYcLBsf3p8ClGZmuUPo3kn6c+YwGXPJT8VdaboKhF kFwjS5fCr1+ofAqJmTFUl+d9cEhBtGv7VVusNYTkKUtnWD0BTEQenGybka2KxR6WmE dvk5Lx0wAf40dPH2qlr+wI0IVByxBBECP7Z9x3NE= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 17 Aug 2019 18:21:04 +0300 Message-Id: <20190817152104.10834-19-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190817152104.10834-1-laurent.pinchart@ideasonboard.com> References: <20190817152104.10834-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 18/18] test: Simplify tests with parent-child relationships X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Aug 2019 15:21:20 -0000 Create object instances with a parent to avoid the need for reparenting objects manually. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Niklas Söderlund --- test/event-thread.cpp | 8 +------- test/timer-thread.cpp | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/test/event-thread.cpp b/test/event-thread.cpp index 4a82d49b94f1..58f452339f87 100644 --- a/test/event-thread.cpp +++ b/test/event-thread.cpp @@ -26,7 +26,7 @@ public: { pipe(pipefd_); - notifier_ = new EventNotifier(pipefd_[0], EventNotifier::Read); + notifier_ = new EventNotifier(pipefd_[0], EventNotifier::Read, this); notifier_->activated.connect(this, &EventHandler::readReady); } @@ -60,12 +60,6 @@ public: return notified_; } - void moveToThread(Thread *thread) - { - Object::moveToThread(thread); - notifier_->moveToThread(thread); - } - private: void readReady(EventNotifier *notifier) { diff --git a/test/timer-thread.cpp b/test/timer-thread.cpp index b9373050068c..5c1b4ac4a401 100644 --- a/test/timer-thread.cpp +++ b/test/timer-thread.cpp @@ -20,7 +20,7 @@ class TimeoutHandler : public Object { public: TimeoutHandler() - : timeout_(false) + : timer_(this), timeout_(false) { timer_.timeout.connect(this, &TimeoutHandler::timeoutHandler); timer_.start(100); @@ -31,12 +31,6 @@ public: return timeout_; } - void moveToThread(Thread *thread) - { - Object::moveToThread(thread); - timer_.moveToThread(thread); - } - private: void timeoutHandler(Timer *timer) {