From cb5847e726e964cd25e7193f2b4dde6c61e08d0e Mon Sep 17 00:00:00 2001 From: Bhushan Shah Date: Fri, 15 Jun 2018 16:53:10 +0530 Subject: [PATCH] Fix some of cppcheck warnings Summary: - selfInitialization - memleak I could probably suppress the selfInitialization warning, but probably is cleaner this way. Opinions welcome. This also fixes the memleak in autotest. Test Plan: - arc lint --everything - Fix issues - build - run tests Reviewers: #frameworks, aacid Reviewed By: aacid Subscribers: apol, aacid, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D13559 --- src/wayland/autotests/server/test_display.cpp | 8 ++++---- src/wayland/dpms_interface.cpp | 8 ++++---- src/wayland/server/xdgoutput_interface.cpp | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/wayland/autotests/server/test_display.cpp b/src/wayland/autotests/server/test_display.cpp index f9e2ee607c..b70b53faec 100644 --- a/src/wayland/autotests/server/test_display.cpp +++ b/src/wayland/autotests/server/test_display.cpp @@ -207,10 +207,10 @@ void TestWaylandServerDisplay::testConnectNoSocket() void TestWaylandServerDisplay::testOutputManagement() { - auto display = new KWayland::Server::Display(this); - display->setSocketName("kwayland-test-0"); - display->start(); - auto kwin = display->createOutputManagement(this); + Display display; + display.setSocketName("kwayland-test-0"); + display.start(); + auto kwin = display.createOutputManagement(this); kwin->create(); QVERIFY(kwin->isValid()); } diff --git a/src/wayland/dpms_interface.cpp b/src/wayland/dpms_interface.cpp index ce57d369ec..3f48e43352 100644 --- a/src/wayland/dpms_interface.cpp +++ b/src/wayland/dpms_interface.cpp @@ -34,9 +34,9 @@ const struct org_kde_kwin_dpms_manager_interface DpmsManagerInterface::Private:: }; #endif -DpmsManagerInterface::Private::Private(DpmsManagerInterface *q, Display *d) +DpmsManagerInterface::Private::Private(DpmsManagerInterface *qptr, Display *d) : Global::Private(d, &org_kde_kwin_dpms_manager_interface, s_version) - , q(q) + , q(qptr) { } @@ -82,9 +82,9 @@ const struct org_kde_kwin_dpms_interface DpmsInterface::Private::s_interface = { }; #endif -DpmsInterface::Private::Private(DpmsInterface *q, DpmsManagerInterface *g, wl_resource *parentResource, OutputInterface *output) +DpmsInterface::Private::Private(DpmsInterface *q, DpmsManagerInterface *g, wl_resource *parentResource, OutputInterface *outputInterface) : Resource::Private(q, g, parentResource, &org_kde_kwin_dpms_interface, &s_interface) - , output(output) + , output(outputInterface) { } diff --git a/src/wayland/server/xdgoutput_interface.cpp b/src/wayland/server/xdgoutput_interface.cpp index 7794021272..6d516260f2 100644 --- a/src/wayland/server/xdgoutput_interface.cpp +++ b/src/wayland/server/xdgoutput_interface.cpp @@ -150,9 +150,9 @@ void XdgOutputManagerInterface::Private::getXdgOutputCallback(wl_client *client, }); } -XdgOutputManagerInterface::Private::Private(XdgOutputManagerInterface *q, Display *d) +XdgOutputManagerInterface::Private::Private(XdgOutputManagerInterface *qptr, Display *d) : Global::Private(d, &zxdg_output_manager_v1_interface, s_version) - , q(q) + , q(qptr) { }