From patchwork Mon Aug 12 12:46:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1796 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A34260E38 for ; Mon, 12 Aug 2019 14:46:56 +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 95E7713CC for ; Mon, 12 Aug 2019 14:46:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1565614015; bh=9FXzsXVjHAzgwSwp7ID6YmB7uFpW5JN8wCJsYD6umN0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Tub1ZnCwvvJqz9fCpxVY/GMcNUt1fVxEFRROjncMn7R7VZ6bQ1N4Iqn81rr6tYRf/ FfmGYqP2qaGVtNlt7m8uBGTc+WJUuvXBTkNsPd30J0yOU1dWkKmZdmx0ksRB5VgOm+ S9LZyjAw1SxfJZTHRR1cXnzH2xOVJy6kpF7NFbzU= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 12 Aug 2019 15:46:42 +0300 Message-Id: <20190812124642.24287-19-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190812124642.24287-1-laurent.pinchart@ideasonboard.com> References: <20190812124642.24287-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 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: Mon, 12 Aug 2019 12:46:56 -0000 Create object instances with a parent to avoid the need for reparenting objects manually. Signed-off-by: Laurent Pinchart 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) {