Mir

Merge lp:~mir-team/mir/fix-1672960 into lp:mir

Proposed by Alan Griffiths on 2017-08-07
Status: Merged
Approved by: Alan Griffiths on 2017-08-09
Approved revision: 4218
Merged at revision: 4221
Proposed branch: lp:~mir-team/mir/fix-1672960
Merge into: lp:mir
Diff against target: 64 lines (+8/-15)
1 file modified
src/server/frontend/protobuf_message_processor.cpp (+8/-15)
To merge this branch: bzr merge lp:~mir-team/mir/fix-1672960
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) 2017-08-07 Approve on 2017-08-08
Mir CI Bot continuous-integration Approve on 2017-08-07
Review via email: mp+328655@code.launchpad.net

Commit message

Don't destroy an IPC "closure" object when it may yet be used. (LP: #1672960)

To post a comment you must log in.
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4218
https://mir-jenkins.ubuntu.com/job/mir-ci/3537/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4838/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5039
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5028
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5028
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5028
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4875/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4875
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4875/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4875/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4875
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4875/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4875
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4875/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4875
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4875/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4875
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4875/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4875
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4875/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3537/rebuild

review: Needs Fixing (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4218
https://mir-jenkins.ubuntu.com/job/mir-ci/3540/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4843
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5044
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5033
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5033
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5033
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4880
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4880/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4880
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4880/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4880
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4880/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4880
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4880/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4880
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4880/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4880
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4880/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4880
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4880/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4880
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4880/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3540/rebuild

review: Approve (continuous-integration)
Brandon Schaefer (brandontschaefer) wrote :

Nice, lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/frontend/protobuf_message_processor.cpp'
2--- src/server/frontend/protobuf_message_processor.cpp 2017-06-01 13:04:37 +0000
3+++ src/server/frontend/protobuf_message_processor.cpp 2017-08-07 10:04:17 +0000
4@@ -76,30 +76,23 @@
5 return request;
6 }
7
8-class SelfDeletingCallback : public google::protobuf::Closure
9+class CallbackClosure : public google::protobuf::Closure
10 {
11 public:
12- SelfDeletingCallback(std::function<void()> const& callback)
13+ CallbackClosure(std::function<void()> const& callback)
14 : callback(callback)
15 {
16 }
17
18 void Run() override
19 {
20- struct Deleter
21- {
22- ~Deleter() { delete obj; }
23- SelfDeletingCallback* obj;
24- };
25- Deleter deleter{this};
26 callback();
27 }
28
29 private:
30- ~SelfDeletingCallback() = default;
31- SelfDeletingCallback(SelfDeletingCallback&) = delete;
32- void operator=(const SelfDeletingCallback&) = delete;
33- std::function<void()> callback;
34+ CallbackClosure(CallbackClosure&) = delete;
35+ void operator=(const CallbackClosure&) = delete;
36+ std::function<void()> const callback;
37 };
38
39 template<typename RequestType, typename ResponseType>
40@@ -125,14 +118,14 @@
41 }
42 };
43
44- auto callback = new SelfDeletingCallback{response_callback};
45+ CallbackClosure callback{response_callback};
46
47 try
48 {
49 (server->*function)(
50 request,
51 result_message.get(),
52- callback);
53+ &callback);
54 }
55 catch (mir::cookie::SecurityCheckError const& /*err*/)
56 {
57@@ -149,7 +142,7 @@
58 using namespace std::literals;
59 result_message->set_error("Error processing request: "s +
60 x.what() + "\nInternal error details: " + boost::diagnostic_information(x));
61- callback->Run();
62+ callback.Run();
63 }
64 }
65

Subscribers

People subscribed via source and target branches