Merge lp:~aacid/unity8/member_to_local_var into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 2410
Merged at revision: 2465
Proposed branch: lp:~aacid/unity8/member_to_local_var
Merge into: lp:unity8
Diff against target: 28 lines (+2/-4)
2 files modified
plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp (+2/-2)
plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux_p.h (+0/-2)
To merge this branch: bzr merge lp:~aacid/unity8/member_to_local_var
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve
Lukáš Tinkl (community) Approve
Review via email: mp+295808@code.launchpad.net

Commit message

Make notifier and notifierFd function local variables

No need for them to be class members if we only use them in init()

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

Coverity was complaining they were not initialized in the constructor

To post a comment you must log in.
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Are you sure about the "notifier" change? The pointer is used in the signal below

review: Needs Information
Revision history for this message
Albert Astals Cid (aacid) wrote :

> Are you sure about the "notifier" change? The pointer is used in the signal
> below

Which line? I can't find any use of "notifier" in onUDevChanges ? (it also compiles)

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

> > Are you sure about the "notifier" change? The pointer is used in the signal
> > below
>
> Which line? I can't find any use of "notifier" in onUDevChanges ? (it also
> compiles)

Sure but wouldn't the local variable go out of scope, when the ctor is done?

Revision history for this message
Albert Astals Cid (aacid) wrote :

> > > Are you sure about the "notifier" change? The pointer is used in the
> signal
> > > below
> >
> > Which line? I can't find any use of "notifier" in onUDevChanges ? (it also
> > compiles)
>
> Sure but wouldn't the local variable go out of scope, when the ctor is done?

Yes, the variable goes out of scope, but it's not a QScopePointer or "strange" just an object so the QSocketNotifier doesn't get deleted, we just get a wait to reference it.

It could be a memory leak, but since it's a QObject with parent it will get deleted when the QInputDeviceManagerPrivate gets destroyed.

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Alright, makes sense after all

review: Approve
Revision history for this message
Michał Sawicz (saviq) wrote :

Since this is a copy from Qt upstream, we should probably recommend that change there?

Revision history for this message
Albert Astals Cid (aacid) wrote :

I tried finding the upstream code that this matches to, failed.

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1356/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/1794
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/891
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/891
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/891
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1824
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1769
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1769
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1769
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1761
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1761/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1761
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1761/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1761
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1761/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1761
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1761/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1761
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1761/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1761
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1761/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1761
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1761/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1761
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1761/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1761
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1761/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1356/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1392/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/1858
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/941
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/941
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/941
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1884
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1822
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1822
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1822
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1813
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1813/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1813
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1813/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1813
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1813/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1813
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1813/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1813
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1813/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1813
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1813/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1813
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1813/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1813
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1813/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1813
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1813/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1392/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp'
2--- plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp 2015-12-04 19:48:17 +0000
3+++ plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp 2016-05-26 09:09:24 +0000
4@@ -83,9 +83,9 @@
5 udev_enumerate_add_match_subsystem(enumerate, subsystem.toLatin1());
6
7 udev_monitor_enable_receiving(udevMonitor);
8- notifierFd = udev_monitor_get_fd(udevMonitor);
9+ int notifierFd = udev_monitor_get_fd(udevMonitor);
10
11- notifier = new QSocketNotifier(notifierFd, QSocketNotifier::Read, this);
12+ QSocketNotifier *notifier = new QSocketNotifier(notifierFd, QSocketNotifier::Read, this);
13 connect(notifier, SIGNAL(activated(int)), this, SLOT(onUDevChanges()));
14
15 udev_enumerate_scan_devices(enumerate);
16
17=== modified file 'plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux_p.h'
18--- plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux_p.h 2015-10-01 10:58:40 +0000
19+++ plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux_p.h 2016-05-26 09:09:24 +0000
20@@ -83,8 +83,6 @@
21
22 QInputDevice *addDevice(const QString &path);
23 void removeDevice(const QString &path);
24- QSocketNotifier *notifier;
25- int notifierFd;
26 struct udev_monitor *udevMonitor;
27 QInputDevice::InputTypeFlags getInputTypeFlags(struct udev_device *);
28 struct udev *udevice;

Subscribers

People subscribed via source and target branches