Mir

Merge lp:~alan-griffiths/mir/fix-1575211 into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Cemil Azizoglu
Approved revision: no longer in the source branch.
Merged at revision: 3481
Proposed branch: lp:~alan-griffiths/mir/fix-1575211
Merge into: lp:mir
Diff against target: 37 lines (+5/-5)
1 file modified
examples/server_example_window_management_info.cpp (+5/-5)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-1575211
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Cemil Azizoglu (community) Approve
Alberto Aguirre (community) Approve
Review via email: mp+293090@code.launchpad.net

Commit message

examples: fix racy code that fails to ensure buffers are posted exactly once

Description of the change

examples: fix racy code that fails to ensure buffers are posted exactly once

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

FAILED: Continuous integration, rev:3481
https://mir-jenkins.ubuntu.com/job/mir-ci/907/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/951/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/992
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/983
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/983
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/961
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/961/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/961
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/961/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/961
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/961/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/961
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/961/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/961/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

LGTM.

Failure is lp:1570698

review: Approve
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

lgtm

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/server_example_window_management_info.cpp'
2--- examples/server_example_window_management_info.cpp 2016-04-15 03:41:28 +0000
3+++ examples/server_example_window_management_info.cpp 2016-04-27 12:02:30 +0000
4@@ -171,29 +171,29 @@
5 SwappingPainter(std::shared_ptr<frontend::BufferStream> const& buffer_stream) :
6 buffer_stream{buffer_stream}, buffer{nullptr}
7 {
8- swap_buffers();
9+ swap_buffers(nullptr);
10 }
11
12- void swap_buffers()
13+ void swap_buffers(graphics::Buffer* buf)
14 {
15 auto const callback = [this](mir::graphics::Buffer* new_buffer)
16 {
17 buffer.store(new_buffer);
18 };
19
20- buffer_stream->swap_buffers(buffer, callback);
21+ buffer_stream->swap_buffers(buf, callback);
22 }
23
24 void paint(int intensity) override
25 {
26- if (auto const buf = buffer.load())
27+ if (graphics::Buffer* buf = buffer.exchange(nullptr))
28 {
29 auto const format = buffer_stream->pixel_format();
30 auto const sz = buf->size().height.as_int() *
31 buf->size().width.as_int() * MIR_BYTES_PER_PIXEL(format);
32 std::vector<unsigned char> pixels(sz, intensity);
33 buf->write(pixels.data(), sz);
34- swap_buffers();
35+ swap_buffers(buf);
36 }
37 }
38

Subscribers

People subscribed via source and target branches