Mir

Merge lp:~raof/mir/fewer-nasal-daemons into lp:mir

Proposed by Chris Halse Rogers
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 4275
Proposed branch: lp:~raof/mir/fewer-nasal-daemons
Merge into: lp:mir
Diff against target: 1394 lines (+841/-82)
5 files modified
include/common/mir/log.h (+12/-1)
src/common/log.cpp (+35/-0)
src/protocol/wrapper_generator.cpp (+47/-19)
src/server/frontend/wayland/core_generated_interfaces.h (+734/-61)
src/server/frontend/wayland/wayland_connector.cpp (+13/-1)
To merge this branch: bzr merge lp:~raof/mir/fewer-nasal-daemons
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+331380@code.launchpad.net

Commit message

Wayland: Prevent C++ exceptions escaping into C code.

That invokes undefined behaviour, and, in practice, results in GCC-built code aborting.

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

FAILED: Continuous integration, rev:4283
https://mir-jenkins.ubuntu.com/job/mir-ci/3698/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5070/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5306
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5294
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5294
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5294
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5114/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5114/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5114/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5114/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5114/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/5114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5114/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/5114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5114/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5114/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

+ try
+ {
+ me->subtract(x, y, width, height);
+ }
+ catch(std::exception const& err)
+ {
+ ::mir::log(
+ ::mir::logging::Severity::critical,
+ "frontend:Wayland",
+ "Exception processing Region::subtract() request: %s",
+ boost::diagnostic_information(err).c_str());
+ }
+ catch (...)
+ {
+ ::mir::log(
+ ::mir::logging::Severity::critical,
+ "frontend:Wayland",
+ "Unknown exception processing Region::subtract() request");
+ }

Couldn't this repeated code be extracted into a function? Similar to mir::report_exception()?

Revision history for this message
Chris Halse Rogers (raof) wrote :

I was thinking of a mir::log_exception() while writing this. Will do.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4285
https://mir-jenkins.ubuntu.com/job/mir-ci/3699/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/5071
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5307
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5295
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5295
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5295
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5115
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5115/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5115
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5115/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5115
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5115/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5115
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5115/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5115
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5115/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/5115
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5115/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/5115
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5115/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5115
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5115/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

OK

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'include/common/mir/log.h'
--- include/common/mir/log.h 2017-07-28 17:00:43 +0000
+++ include/common/mir/log.h 2017-09-27 16:01:58 +0000
@@ -34,6 +34,11 @@
34 char const* fmt, ...);34 char const* fmt, ...);
35void log(logging::Severity sev, const char *component,35void log(logging::Severity sev, const char *component,
36 std::string const& message);36 std::string const& message);
37void log(
38 logging::Severity sev,
39 char const* component,
40 std::exception_ptr const& exception,
41 std::string const& message);
3742
38#ifndef MIR_LOG_COMPONENT43#ifndef MIR_LOG_COMPONENT
39#ifdef MIR_LOG_COMPONENT_FALLBACK44#ifdef MIR_LOG_COMPONENT_FALLBACK
@@ -79,6 +84,13 @@
79 MIR_LOG_COMPONENT, message);84 MIR_LOG_COMPONENT, message);
80}85}
8186
87template<typename... Args>
88void log_critical(char const* fmt, Args&&... args)
89{
90 ::mir::log(::mir::logging::Severity::critical,
91 MIR_LOG_COMPONENT, fmt, std::forward<Args>(args)...);
92}
93
82inline void log_error(std::string const& message)94inline void log_error(std::string const& message)
83{95{
84 ::mir::log(::mir::logging::Severity::error,96 ::mir::log(::mir::logging::Severity::error,
@@ -97,7 +109,6 @@
97 ::mir::log(::mir::logging::Severity::warning,109 ::mir::log(::mir::logging::Severity::warning,
98 MIR_LOG_COMPONENT, fmt, std::forward<Args>(args)...);110 MIR_LOG_COMPONENT, fmt, std::forward<Args>(args)...);
99}111}
100
101} // (nested anonymous) namespace112} // (nested anonymous) namespace
102#endif113#endif
103114
104115
=== modified file 'src/common/log.cpp'
--- src/common/log.cpp 2017-07-28 17:00:43 +0000
+++ src/common/log.cpp 2017-09-27 16:01:58 +0000
@@ -20,6 +20,9 @@
20#include "mir/logging/logger.h"20#include "mir/logging/logger.h"
21#include <cstdio>21#include <cstdio>
2222
23#include <exception>
24#include <boost/exception/diagnostic_information.hpp>
25
23namespace mir {26namespace mir {
2427
25void logv(logging::Severity sev, char const* component,28void logv(logging::Severity sev, char const* component,
@@ -51,4 +54,36 @@
51 logging::log(sev, message, component);54 logging::log(sev, message, component);
52}55}
5356
57
58void log(
59 logging::Severity severity,
60 char const* component,
61 std::exception_ptr const& ex,
62 std::string const& message)
63{
64 try
65 {
66 std::rethrow_exception(ex);
67 }
68 catch(std::exception const& err)
69 {
70 // TODO: We can probably format this better by pulling out
71 // the boost::errinfo's ourselves.
72 mir::log(
73 severity,
74 component,
75 "%s: %s",
76 message.c_str(),
77 boost::diagnostic_information(err).c_str());
78 }
79 catch(...)
80 {
81 mir::log(
82 severity,
83 component,
84 "%s: unknown exception",
85 message.c_str());
86 }
87}
88
54} // namespace mir89} // namespace mir
5590
=== modified file 'src/protocol/wrapper_generator.cpp'
--- src/protocol/wrapper_generator.cpp 2017-09-25 15:34:10 +0000
+++ src/protocol/wrapper_generator.cpp 2017-09-27 16:01:58 +0000
@@ -41,11 +41,13 @@
41{41{
42 std::cout << "#include <experimental/optional>" << std::endl;42 std::cout << "#include <experimental/optional>" << std::endl;
43 std::cout << "#include <boost/throw_exception.hpp>" << std::endl;43 std::cout << "#include <boost/throw_exception.hpp>" << std::endl;
44 std::cout << "#include <boost/exception/diagnostic_information.hpp>" << std::endl;
44 std::cout << std::endl;45 std::cout << std::endl;
45 std::cout << "#include <wayland-server.h>" << std::endl;46 std::cout << "#include <wayland-server.h>" << std::endl;
46 std::cout << "#include <wayland-server-protocol.h>" << std::endl;47 std::cout << "#include <wayland-server-protocol.h>" << std::endl;
47 std::cout << std::endl;48 std::cout << std::endl;
48 std::cout << "#include \"mir/fd.h\"" << std::endl;49 std::cout << "#include \"mir/fd.h\"" << std::endl;
50 std::cout << "#include \"mir/log.h\"" << std::endl;
49}51}
5052
51std::string strip_wl_prefix(std::string const& name)53std::string strip_wl_prefix(std::string const& name)
@@ -121,6 +123,20 @@
121 return false;123 return false;
122}124}
123125
126void emit_indented_lines(std::ostream& out, std::string const& indent,
127 std::initializer_list<std::initializer_list<std::string>> lines)
128{
129 for (auto const& line : lines)
130 {
131 out << indent;
132 for (auto const& fragment : line)
133 {
134 out << fragment;
135 }
136 out << std::endl;
137 }
138}
139
124class Interface;140class Interface;
125141
126class Argument142class Argument
@@ -216,15 +232,27 @@
216 }232 }
217 out << ")" << std::endl;233 out << ")" << std::endl;
218234
219 out << indent << "{" << std::endl;235 emit_indented_lines(
220 out << indent << " auto me = static_cast<" << interface_type << "*>("236 out,
221 << "wl_resource_get_user_data(resource));" << std::endl;237 indent,
238 {
239 {"{"},
240 {" auto me = static_cast<", interface_type, "*>(wl_resource_get_user_data(resource));"}
241 });
242
222 for (auto const& arg : arguments)243 for (auto const& arg : arguments)
223 {244 {
224 arg.emit_thunk_converter(out, indent + " ");245 arg.emit_thunk_converter(out, indent + " ");
225 }246 }
226247
227 out << indent << " me->" << name << "(";248 emit_indented_lines(
249 out,
250 indent,
251 {
252 {" try"},
253 {" {"},
254 });
255 out << indent << " me->" << name << "(";
228 if (is_global)256 if (is_global)
229 {257 {
230 out << "client, resource";258 out << "client, resource";
@@ -243,7 +271,21 @@
243 }271 }
244 out << ");" << std::endl;272 out << ");" << std::endl;
245273
246 out << indent << "}" << std::endl;274 emit_indented_lines(
275 out,
276 indent,
277 {
278 {" }"},
279 {" catch(...)"},
280 {" {"},
281 {" ::mir::log("},
282 {" ::mir::logging::Severity::critical,"},
283 {" \"frontend:Wayland\","},
284 {" std::current_exception(),"},
285 {" \"Exception processing ", interface_type, "::", name, "() request\");"},
286 {" }"},
287 {"}"}
288 });
247 }289 }
248290
249 void emit_vtable_initialiser(std::ostream& out, std::string const& indent) const291 void emit_vtable_initialiser(std::ostream& out, std::string const& indent) const
@@ -256,20 +298,6 @@
256 std::vector<Argument> arguments;298 std::vector<Argument> arguments;
257};299};
258300
259void emit_indented_lines(std::ostream& out, std::string const& indent,
260 std::initializer_list<std::initializer_list<std::string>> lines)
261{
262 for (auto const& line : lines)
263 {
264 out << indent;
265 for (auto const& fragment : line)
266 {
267 out << fragment;
268 }
269 out << std::endl;
270 }
271}
272
273class Interface301class Interface
274{302{
275public:303public:
276304
=== modified file 'src/server/frontend/wayland/core_generated_interfaces.h'
--- src/server/frontend/wayland/core_generated_interfaces.h 2017-09-25 15:34:10 +0000
+++ src/server/frontend/wayland/core_generated_interfaces.h 2017-09-27 16:01:58 +0000
@@ -7,11 +7,13 @@
77
8#include <experimental/optional>8#include <experimental/optional>
9#include <boost/throw_exception.hpp>9#include <boost/throw_exception.hpp>
10#include <boost/exception/diagnostic_information.hpp>
1011
11#include <wayland-server.h>12#include <wayland-server.h>
12#include <wayland-server-protocol.h>13#include <wayland-server-protocol.h>
1314
14#include "mir/fd.h"15#include "mir/fd.h"
16#include "mir/log.h"
1517
16namespace mir18namespace mir
17{19{
@@ -64,13 +66,35 @@
64 static void create_surface_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)66 static void create_surface_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)
65 {67 {
66 auto me = static_cast<Compositor*>(wl_resource_get_user_data(resource));68 auto me = static_cast<Compositor*>(wl_resource_get_user_data(resource));
67 me->create_surface(client, resource, id);69 try
70 {
71 me->create_surface(client, resource, id);
72 }
73 catch(...)
74 {
75 ::mir::log(
76 ::mir::logging::Severity::critical,
77 "frontend:Wayland",
78 std::current_exception(),
79 "Exception processing Compositor::create_surface() request");
80 }
68 }81 }
6982
70 static void create_region_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)83 static void create_region_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)
71 {84 {
72 auto me = static_cast<Compositor*>(wl_resource_get_user_data(resource));85 auto me = static_cast<Compositor*>(wl_resource_get_user_data(resource));
73 me->create_region(client, resource, id);86 try
87 {
88 me->create_region(client, resource, id);
89 }
90 catch(...)
91 {
92 ::mir::log(
93 ::mir::logging::Severity::critical,
94 "frontend:Wayland",
95 std::current_exception(),
96 "Exception processing Compositor::create_region() request");
97 }
74 }98 }
7599
76 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)100 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
@@ -123,19 +147,52 @@
123 static void create_buffer_thunk(struct wl_client*, struct wl_resource* resource, uint32_t id, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format)147 static void create_buffer_thunk(struct wl_client*, struct wl_resource* resource, uint32_t id, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format)
124 {148 {
125 auto me = static_cast<ShmPool*>(wl_resource_get_user_data(resource));149 auto me = static_cast<ShmPool*>(wl_resource_get_user_data(resource));
126 me->create_buffer(id, offset, width, height, stride, format);150 try
151 {
152 me->create_buffer(id, offset, width, height, stride, format);
153 }
154 catch(...)
155 {
156 ::mir::log(
157 ::mir::logging::Severity::critical,
158 "frontend:Wayland",
159 std::current_exception(),
160 "Exception processing ShmPool::create_buffer() request");
161 }
127 }162 }
128163
129 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)164 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
130 {165 {
131 auto me = static_cast<ShmPool*>(wl_resource_get_user_data(resource));166 auto me = static_cast<ShmPool*>(wl_resource_get_user_data(resource));
132 me->destroy();167 try
168 {
169 me->destroy();
170 }
171 catch(...)
172 {
173 ::mir::log(
174 ::mir::logging::Severity::critical,
175 "frontend:Wayland",
176 std::current_exception(),
177 "Exception processing ShmPool::destroy() request");
178 }
133 }179 }
134180
135 static void resize_thunk(struct wl_client*, struct wl_resource* resource, int32_t size)181 static void resize_thunk(struct wl_client*, struct wl_resource* resource, int32_t size)
136 {182 {
137 auto me = static_cast<ShmPool*>(wl_resource_get_user_data(resource));183 auto me = static_cast<ShmPool*>(wl_resource_get_user_data(resource));
138 me->resize(size);184 try
185 {
186 me->resize(size);
187 }
188 catch(...)
189 {
190 ::mir::log(
191 ::mir::logging::Severity::critical,
192 "frontend:Wayland",
193 std::current_exception(),
194 "Exception processing ShmPool::resize() request");
195 }
139 }196 }
140197
141 static void resource_destroyed_thunk(wl_resource* us)198 static void resource_destroyed_thunk(wl_resource* us)
@@ -174,7 +231,18 @@
174 {231 {
175 auto me = static_cast<Shm*>(wl_resource_get_user_data(resource));232 auto me = static_cast<Shm*>(wl_resource_get_user_data(resource));
176 mir::Fd fd_resolved{fd};233 mir::Fd fd_resolved{fd};
177 me->create_pool(client, resource, id, fd_resolved, size);234 try
235 {
236 me->create_pool(client, resource, id, fd_resolved, size);
237 }
238 catch(...)
239 {
240 ::mir::log(
241 ::mir::logging::Severity::critical,
242 "frontend:Wayland",
243 std::current_exception(),
244 "Exception processing Shm::create_pool() request");
245 }
178 }246 }
179247
180 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)248 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
@@ -224,7 +292,18 @@
224 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)292 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
225 {293 {
226 auto me = static_cast<Buffer*>(wl_resource_get_user_data(resource));294 auto me = static_cast<Buffer*>(wl_resource_get_user_data(resource));
227 me->destroy();295 try
296 {
297 me->destroy();
298 }
299 catch(...)
300 {
301 ::mir::log(
302 ::mir::logging::Severity::critical,
303 "frontend:Wayland",
304 std::current_exception(),
305 "Exception processing Buffer::destroy() request");
306 }
228 }307 }
229308
230 static void resource_destroyed_thunk(wl_resource* us)309 static void resource_destroyed_thunk(wl_resource* us)
@@ -273,32 +352,87 @@
273 {352 {
274 mime_type_resolved = std::experimental::make_optional<std::string>(mime_type);353 mime_type_resolved = std::experimental::make_optional<std::string>(mime_type);
275 }354 }
276 me->accept(serial, mime_type_resolved);355 try
356 {
357 me->accept(serial, mime_type_resolved);
358 }
359 catch(...)
360 {
361 ::mir::log(
362 ::mir::logging::Severity::critical,
363 "frontend:Wayland",
364 std::current_exception(),
365 "Exception processing DataOffer::accept() request");
366 }
277 }367 }
278368
279 static void receive_thunk(struct wl_client*, struct wl_resource* resource, char const* mime_type, int fd)369 static void receive_thunk(struct wl_client*, struct wl_resource* resource, char const* mime_type, int fd)
280 {370 {
281 auto me = static_cast<DataOffer*>(wl_resource_get_user_data(resource));371 auto me = static_cast<DataOffer*>(wl_resource_get_user_data(resource));
282 mir::Fd fd_resolved{fd};372 mir::Fd fd_resolved{fd};
283 me->receive(mime_type, fd_resolved);373 try
374 {
375 me->receive(mime_type, fd_resolved);
376 }
377 catch(...)
378 {
379 ::mir::log(
380 ::mir::logging::Severity::critical,
381 "frontend:Wayland",
382 std::current_exception(),
383 "Exception processing DataOffer::receive() request");
384 }
284 }385 }
285386
286 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)387 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
287 {388 {
288 auto me = static_cast<DataOffer*>(wl_resource_get_user_data(resource));389 auto me = static_cast<DataOffer*>(wl_resource_get_user_data(resource));
289 me->destroy();390 try
391 {
392 me->destroy();
393 }
394 catch(...)
395 {
396 ::mir::log(
397 ::mir::logging::Severity::critical,
398 "frontend:Wayland",
399 std::current_exception(),
400 "Exception processing DataOffer::destroy() request");
401 }
290 }402 }
291403
292 static void finish_thunk(struct wl_client*, struct wl_resource* resource)404 static void finish_thunk(struct wl_client*, struct wl_resource* resource)
293 {405 {
294 auto me = static_cast<DataOffer*>(wl_resource_get_user_data(resource));406 auto me = static_cast<DataOffer*>(wl_resource_get_user_data(resource));
295 me->finish();407 try
408 {
409 me->finish();
410 }
411 catch(...)
412 {
413 ::mir::log(
414 ::mir::logging::Severity::critical,
415 "frontend:Wayland",
416 std::current_exception(),
417 "Exception processing DataOffer::finish() request");
418 }
296 }419 }
297420
298 static void set_actions_thunk(struct wl_client*, struct wl_resource* resource, uint32_t dnd_actions, uint32_t preferred_action)421 static void set_actions_thunk(struct wl_client*, struct wl_resource* resource, uint32_t dnd_actions, uint32_t preferred_action)
299 {422 {
300 auto me = static_cast<DataOffer*>(wl_resource_get_user_data(resource));423 auto me = static_cast<DataOffer*>(wl_resource_get_user_data(resource));
301 me->set_actions(dnd_actions, preferred_action);424 try
425 {
426 me->set_actions(dnd_actions, preferred_action);
427 }
428 catch(...)
429 {
430 ::mir::log(
431 ::mir::logging::Severity::critical,
432 "frontend:Wayland",
433 std::current_exception(),
434 "Exception processing DataOffer::set_actions() request");
435 }
302 }436 }
303437
304 static void resource_destroyed_thunk(wl_resource* us)438 static void resource_destroyed_thunk(wl_resource* us)
@@ -344,19 +478,52 @@
344 static void offer_thunk(struct wl_client*, struct wl_resource* resource, char const* mime_type)478 static void offer_thunk(struct wl_client*, struct wl_resource* resource, char const* mime_type)
345 {479 {
346 auto me = static_cast<DataSource*>(wl_resource_get_user_data(resource));480 auto me = static_cast<DataSource*>(wl_resource_get_user_data(resource));
347 me->offer(mime_type);481 try
482 {
483 me->offer(mime_type);
484 }
485 catch(...)
486 {
487 ::mir::log(
488 ::mir::logging::Severity::critical,
489 "frontend:Wayland",
490 std::current_exception(),
491 "Exception processing DataSource::offer() request");
492 }
348 }493 }
349494
350 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)495 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
351 {496 {
352 auto me = static_cast<DataSource*>(wl_resource_get_user_data(resource));497 auto me = static_cast<DataSource*>(wl_resource_get_user_data(resource));
353 me->destroy();498 try
499 {
500 me->destroy();
501 }
502 catch(...)
503 {
504 ::mir::log(
505 ::mir::logging::Severity::critical,
506 "frontend:Wayland",
507 std::current_exception(),
508 "Exception processing DataSource::destroy() request");
509 }
354 }510 }
355511
356 static void set_actions_thunk(struct wl_client*, struct wl_resource* resource, uint32_t dnd_actions)512 static void set_actions_thunk(struct wl_client*, struct wl_resource* resource, uint32_t dnd_actions)
357 {513 {
358 auto me = static_cast<DataSource*>(wl_resource_get_user_data(resource));514 auto me = static_cast<DataSource*>(wl_resource_get_user_data(resource));
359 me->set_actions(dnd_actions);515 try
516 {
517 me->set_actions(dnd_actions);
518 }
519 catch(...)
520 {
521 ::mir::log(
522 ::mir::logging::Severity::critical,
523 "frontend:Wayland",
524 std::current_exception(),
525 "Exception processing DataSource::set_actions() request");
526 }
360 }527 }
361528
362 static void resource_destroyed_thunk(wl_resource* us)529 static void resource_destroyed_thunk(wl_resource* us)
@@ -410,7 +577,18 @@
410 {577 {
411 icon_resolved = icon;578 icon_resolved = icon;
412 }579 }
413 me->start_drag(source_resolved, origin, icon_resolved, serial);580 try
581 {
582 me->start_drag(source_resolved, origin, icon_resolved, serial);
583 }
584 catch(...)
585 {
586 ::mir::log(
587 ::mir::logging::Severity::critical,
588 "frontend:Wayland",
589 std::current_exception(),
590 "Exception processing DataDevice::start_drag() request");
591 }
414 }592 }
415593
416 static void set_selection_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* source, uint32_t serial)594 static void set_selection_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* source, uint32_t serial)
@@ -421,13 +599,35 @@
421 {599 {
422 source_resolved = source;600 source_resolved = source;
423 }601 }
424 me->set_selection(source_resolved, serial);602 try
603 {
604 me->set_selection(source_resolved, serial);
605 }
606 catch(...)
607 {
608 ::mir::log(
609 ::mir::logging::Severity::critical,
610 "frontend:Wayland",
611 std::current_exception(),
612 "Exception processing DataDevice::set_selection() request");
613 }
425 }614 }
426615
427 static void release_thunk(struct wl_client*, struct wl_resource* resource)616 static void release_thunk(struct wl_client*, struct wl_resource* resource)
428 {617 {
429 auto me = static_cast<DataDevice*>(wl_resource_get_user_data(resource));618 auto me = static_cast<DataDevice*>(wl_resource_get_user_data(resource));
430 me->release();619 try
620 {
621 me->release();
622 }
623 catch(...)
624 {
625 ::mir::log(
626 ::mir::logging::Severity::critical,
627 "frontend:Wayland",
628 std::current_exception(),
629 "Exception processing DataDevice::release() request");
630 }
431 }631 }
432632
433 static void resource_destroyed_thunk(wl_resource* us)633 static void resource_destroyed_thunk(wl_resource* us)
@@ -466,13 +666,35 @@
466 static void create_data_source_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)666 static void create_data_source_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)
467 {667 {
468 auto me = static_cast<DataDeviceManager*>(wl_resource_get_user_data(resource));668 auto me = static_cast<DataDeviceManager*>(wl_resource_get_user_data(resource));
469 me->create_data_source(client, resource, id);669 try
670 {
671 me->create_data_source(client, resource, id);
672 }
673 catch(...)
674 {
675 ::mir::log(
676 ::mir::logging::Severity::critical,
677 "frontend:Wayland",
678 std::current_exception(),
679 "Exception processing DataDeviceManager::create_data_source() request");
680 }
470 }681 }
471682
472 static void get_data_device_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id, struct wl_resource* seat)683 static void get_data_device_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id, struct wl_resource* seat)
473 {684 {
474 auto me = static_cast<DataDeviceManager*>(wl_resource_get_user_data(resource));685 auto me = static_cast<DataDeviceManager*>(wl_resource_get_user_data(resource));
475 me->get_data_device(client, resource, id, seat);686 try
687 {
688 me->get_data_device(client, resource, id, seat);
689 }
690 catch(...)
691 {
692 ::mir::log(
693 ::mir::logging::Severity::critical,
694 "frontend:Wayland",
695 std::current_exception(),
696 "Exception processing DataDeviceManager::get_data_device() request");
697 }
476 }698 }
477699
478 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)700 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
@@ -519,7 +741,18 @@
519 static void get_shell_surface_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id, struct wl_resource* surface)741 static void get_shell_surface_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id, struct wl_resource* surface)
520 {742 {
521 auto me = static_cast<Shell*>(wl_resource_get_user_data(resource));743 auto me = static_cast<Shell*>(wl_resource_get_user_data(resource));
522 me->get_shell_surface(client, resource, id, surface);744 try
745 {
746 me->get_shell_surface(client, resource, id, surface);
747 }
748 catch(...)
749 {
750 ::mir::log(
751 ::mir::logging::Severity::critical,
752 "frontend:Wayland",
753 std::current_exception(),
754 "Exception processing Shell::get_shell_surface() request");
755 }
523 }756 }
524757
525 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)758 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
@@ -578,31 +811,86 @@
578 static void pong_thunk(struct wl_client*, struct wl_resource* resource, uint32_t serial)811 static void pong_thunk(struct wl_client*, struct wl_resource* resource, uint32_t serial)
579 {812 {
580 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));813 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
581 me->pong(serial);814 try
815 {
816 me->pong(serial);
817 }
818 catch(...)
819 {
820 ::mir::log(
821 ::mir::logging::Severity::critical,
822 "frontend:Wayland",
823 std::current_exception(),
824 "Exception processing ShellSurface::pong() request");
825 }
582 }826 }
583827
584 static void move_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* seat, uint32_t serial)828 static void move_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* seat, uint32_t serial)
585 {829 {
586 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));830 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
587 me->move(seat, serial);831 try
832 {
833 me->move(seat, serial);
834 }
835 catch(...)
836 {
837 ::mir::log(
838 ::mir::logging::Severity::critical,
839 "frontend:Wayland",
840 std::current_exception(),
841 "Exception processing ShellSurface::move() request");
842 }
588 }843 }
589844
590 static void resize_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* seat, uint32_t serial, uint32_t edges)845 static void resize_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* seat, uint32_t serial, uint32_t edges)
591 {846 {
592 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));847 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
593 me->resize(seat, serial, edges);848 try
849 {
850 me->resize(seat, serial, edges);
851 }
852 catch(...)
853 {
854 ::mir::log(
855 ::mir::logging::Severity::critical,
856 "frontend:Wayland",
857 std::current_exception(),
858 "Exception processing ShellSurface::resize() request");
859 }
594 }860 }
595861
596 static void set_toplevel_thunk(struct wl_client*, struct wl_resource* resource)862 static void set_toplevel_thunk(struct wl_client*, struct wl_resource* resource)
597 {863 {
598 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));864 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
599 me->set_toplevel();865 try
866 {
867 me->set_toplevel();
868 }
869 catch(...)
870 {
871 ::mir::log(
872 ::mir::logging::Severity::critical,
873 "frontend:Wayland",
874 std::current_exception(),
875 "Exception processing ShellSurface::set_toplevel() request");
876 }
600 }877 }
601878
602 static void set_transient_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* parent, int32_t x, int32_t y, uint32_t flags)879 static void set_transient_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* parent, int32_t x, int32_t y, uint32_t flags)
603 {880 {
604 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));881 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
605 me->set_transient(parent, x, y, flags);882 try
883 {
884 me->set_transient(parent, x, y, flags);
885 }
886 catch(...)
887 {
888 ::mir::log(
889 ::mir::logging::Severity::critical,
890 "frontend:Wayland",
891 std::current_exception(),
892 "Exception processing ShellSurface::set_transient() request");
893 }
606 }894 }
607895
608 static void set_fullscreen_thunk(struct wl_client*, struct wl_resource* resource, uint32_t method, uint32_t framerate, struct wl_resource* output)896 static void set_fullscreen_thunk(struct wl_client*, struct wl_resource* resource, uint32_t method, uint32_t framerate, struct wl_resource* output)
@@ -613,13 +901,35 @@
613 {901 {
614 output_resolved = output;902 output_resolved = output;
615 }903 }
616 me->set_fullscreen(method, framerate, output_resolved);904 try
905 {
906 me->set_fullscreen(method, framerate, output_resolved);
907 }
908 catch(...)
909 {
910 ::mir::log(
911 ::mir::logging::Severity::critical,
912 "frontend:Wayland",
913 std::current_exception(),
914 "Exception processing ShellSurface::set_fullscreen() request");
915 }
617 }916 }
618917
619 static void set_popup_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* seat, uint32_t serial, struct wl_resource* parent, int32_t x, int32_t y, uint32_t flags)918 static void set_popup_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* seat, uint32_t serial, struct wl_resource* parent, int32_t x, int32_t y, uint32_t flags)
620 {919 {
621 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));920 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
622 me->set_popup(seat, serial, parent, x, y, flags);921 try
922 {
923 me->set_popup(seat, serial, parent, x, y, flags);
924 }
925 catch(...)
926 {
927 ::mir::log(
928 ::mir::logging::Severity::critical,
929 "frontend:Wayland",
930 std::current_exception(),
931 "Exception processing ShellSurface::set_popup() request");
932 }
623 }933 }
624934
625 static void set_maximized_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* output)935 static void set_maximized_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* output)
@@ -630,19 +940,52 @@
630 {940 {
631 output_resolved = output;941 output_resolved = output;
632 }942 }
633 me->set_maximized(output_resolved);943 try
944 {
945 me->set_maximized(output_resolved);
946 }
947 catch(...)
948 {
949 ::mir::log(
950 ::mir::logging::Severity::critical,
951 "frontend:Wayland",
952 std::current_exception(),
953 "Exception processing ShellSurface::set_maximized() request");
954 }
634 }955 }
635956
636 static void set_title_thunk(struct wl_client*, struct wl_resource* resource, char const* title)957 static void set_title_thunk(struct wl_client*, struct wl_resource* resource, char const* title)
637 {958 {
638 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));959 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
639 me->set_title(title);960 try
961 {
962 me->set_title(title);
963 }
964 catch(...)
965 {
966 ::mir::log(
967 ::mir::logging::Severity::critical,
968 "frontend:Wayland",
969 std::current_exception(),
970 "Exception processing ShellSurface::set_title() request");
971 }
640 }972 }
641973
642 static void set_class_thunk(struct wl_client*, struct wl_resource* resource, char const* class_)974 static void set_class_thunk(struct wl_client*, struct wl_resource* resource, char const* class_)
643 {975 {
644 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));976 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
645 me->set_class(class_);977 try
978 {
979 me->set_class(class_);
980 }
981 catch(...)
982 {
983 ::mir::log(
984 ::mir::logging::Severity::critical,
985 "frontend:Wayland",
986 std::current_exception(),
987 "Exception processing ShellSurface::set_class() request");
988 }
646 }989 }
647990
648 static void resource_destroyed_thunk(wl_resource* us)991 static void resource_destroyed_thunk(wl_resource* us)
@@ -700,7 +1043,18 @@
700 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)1043 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
701 {1044 {
702 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));1045 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
703 me->destroy();1046 try
1047 {
1048 me->destroy();
1049 }
1050 catch(...)
1051 {
1052 ::mir::log(
1053 ::mir::logging::Severity::critical,
1054 "frontend:Wayland",
1055 std::current_exception(),
1056 "Exception processing Surface::destroy() request");
1057 }
704 }1058 }
7051059
706 static void attach_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* buffer, int32_t x, int32_t y)1060 static void attach_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* buffer, int32_t x, int32_t y)
@@ -711,19 +1065,52 @@
711 {1065 {
712 buffer_resolved = buffer;1066 buffer_resolved = buffer;
713 }1067 }
714 me->attach(buffer_resolved, x, y);1068 try
1069 {
1070 me->attach(buffer_resolved, x, y);
1071 }
1072 catch(...)
1073 {
1074 ::mir::log(
1075 ::mir::logging::Severity::critical,
1076 "frontend:Wayland",
1077 std::current_exception(),
1078 "Exception processing Surface::attach() request");
1079 }
715 }1080 }
7161081
717 static void damage_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height)1082 static void damage_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height)
718 {1083 {
719 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));1084 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
720 me->damage(x, y, width, height);1085 try
1086 {
1087 me->damage(x, y, width, height);
1088 }
1089 catch(...)
1090 {
1091 ::mir::log(
1092 ::mir::logging::Severity::critical,
1093 "frontend:Wayland",
1094 std::current_exception(),
1095 "Exception processing Surface::damage() request");
1096 }
721 }1097 }
7221098
723 static void frame_thunk(struct wl_client*, struct wl_resource* resource, uint32_t callback)1099 static void frame_thunk(struct wl_client*, struct wl_resource* resource, uint32_t callback)
724 {1100 {
725 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));1101 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
726 me->frame(callback);1102 try
1103 {
1104 me->frame(callback);
1105 }
1106 catch(...)
1107 {
1108 ::mir::log(
1109 ::mir::logging::Severity::critical,
1110 "frontend:Wayland",
1111 std::current_exception(),
1112 "Exception processing Surface::frame() request");
1113 }
727 }1114 }
7281115
729 static void set_opaque_region_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* region)1116 static void set_opaque_region_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* region)
@@ -734,7 +1121,18 @@
734 {1121 {
735 region_resolved = region;1122 region_resolved = region;
736 }1123 }
737 me->set_opaque_region(region_resolved);1124 try
1125 {
1126 me->set_opaque_region(region_resolved);
1127 }
1128 catch(...)
1129 {
1130 ::mir::log(
1131 ::mir::logging::Severity::critical,
1132 "frontend:Wayland",
1133 std::current_exception(),
1134 "Exception processing Surface::set_opaque_region() request");
1135 }
738 }1136 }
7391137
740 static void set_input_region_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* region)1138 static void set_input_region_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* region)
@@ -745,31 +1143,86 @@
745 {1143 {
746 region_resolved = region;1144 region_resolved = region;
747 }1145 }
748 me->set_input_region(region_resolved);1146 try
1147 {
1148 me->set_input_region(region_resolved);
1149 }
1150 catch(...)
1151 {
1152 ::mir::log(
1153 ::mir::logging::Severity::critical,
1154 "frontend:Wayland",
1155 std::current_exception(),
1156 "Exception processing Surface::set_input_region() request");
1157 }
749 }1158 }
7501159
751 static void commit_thunk(struct wl_client*, struct wl_resource* resource)1160 static void commit_thunk(struct wl_client*, struct wl_resource* resource)
752 {1161 {
753 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));1162 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
754 me->commit();1163 try
1164 {
1165 me->commit();
1166 }
1167 catch(...)
1168 {
1169 ::mir::log(
1170 ::mir::logging::Severity::critical,
1171 "frontend:Wayland",
1172 std::current_exception(),
1173 "Exception processing Surface::commit() request");
1174 }
755 }1175 }
7561176
757 static void set_buffer_transform_thunk(struct wl_client*, struct wl_resource* resource, int32_t transform)1177 static void set_buffer_transform_thunk(struct wl_client*, struct wl_resource* resource, int32_t transform)
758 {1178 {
759 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));1179 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
760 me->set_buffer_transform(transform);1180 try
1181 {
1182 me->set_buffer_transform(transform);
1183 }
1184 catch(...)
1185 {
1186 ::mir::log(
1187 ::mir::logging::Severity::critical,
1188 "frontend:Wayland",
1189 std::current_exception(),
1190 "Exception processing Surface::set_buffer_transform() request");
1191 }
761 }1192 }
7621193
763 static void set_buffer_scale_thunk(struct wl_client*, struct wl_resource* resource, int32_t scale)1194 static void set_buffer_scale_thunk(struct wl_client*, struct wl_resource* resource, int32_t scale)
764 {1195 {
765 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));1196 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
766 me->set_buffer_scale(scale);1197 try
1198 {
1199 me->set_buffer_scale(scale);
1200 }
1201 catch(...)
1202 {
1203 ::mir::log(
1204 ::mir::logging::Severity::critical,
1205 "frontend:Wayland",
1206 std::current_exception(),
1207 "Exception processing Surface::set_buffer_scale() request");
1208 }
767 }1209 }
7681210
769 static void damage_buffer_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height)1211 static void damage_buffer_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height)
770 {1212 {
771 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));1213 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
772 me->damage_buffer(x, y, width, height);1214 try
1215 {
1216 me->damage_buffer(x, y, width, height);
1217 }
1218 catch(...)
1219 {
1220 ::mir::log(
1221 ::mir::logging::Severity::critical,
1222 "frontend:Wayland",
1223 std::current_exception(),
1224 "Exception processing Surface::damage_buffer() request");
1225 }
773 }1226 }
7741227
775 static void resource_destroyed_thunk(wl_resource* us)1228 static void resource_destroyed_thunk(wl_resource* us)
@@ -817,25 +1270,69 @@
817 static void get_pointer_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)1270 static void get_pointer_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)
818 {1271 {
819 auto me = static_cast<Seat*>(wl_resource_get_user_data(resource));1272 auto me = static_cast<Seat*>(wl_resource_get_user_data(resource));
820 me->get_pointer(client, resource, id);1273 try
1274 {
1275 me->get_pointer(client, resource, id);
1276 }
1277 catch(...)
1278 {
1279 ::mir::log(
1280 ::mir::logging::Severity::critical,
1281 "frontend:Wayland",
1282 std::current_exception(),
1283 "Exception processing Seat::get_pointer() request");
1284 }
821 }1285 }
8221286
823 static void get_keyboard_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)1287 static void get_keyboard_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)
824 {1288 {
825 auto me = static_cast<Seat*>(wl_resource_get_user_data(resource));1289 auto me = static_cast<Seat*>(wl_resource_get_user_data(resource));
826 me->get_keyboard(client, resource, id);1290 try
1291 {
1292 me->get_keyboard(client, resource, id);
1293 }
1294 catch(...)
1295 {
1296 ::mir::log(
1297 ::mir::logging::Severity::critical,
1298 "frontend:Wayland",
1299 std::current_exception(),
1300 "Exception processing Seat::get_keyboard() request");
1301 }
827 }1302 }
8281303
829 static void get_touch_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)1304 static void get_touch_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)
830 {1305 {
831 auto me = static_cast<Seat*>(wl_resource_get_user_data(resource));1306 auto me = static_cast<Seat*>(wl_resource_get_user_data(resource));
832 me->get_touch(client, resource, id);1307 try
1308 {
1309 me->get_touch(client, resource, id);
1310 }
1311 catch(...)
1312 {
1313 ::mir::log(
1314 ::mir::logging::Severity::critical,
1315 "frontend:Wayland",
1316 std::current_exception(),
1317 "Exception processing Seat::get_touch() request");
1318 }
833 }1319 }
8341320
835 static void release_thunk(struct wl_client* client, struct wl_resource* resource)1321 static void release_thunk(struct wl_client* client, struct wl_resource* resource)
836 {1322 {
837 auto me = static_cast<Seat*>(wl_resource_get_user_data(resource));1323 auto me = static_cast<Seat*>(wl_resource_get_user_data(resource));
838 me->release(client, resource);1324 try
1325 {
1326 me->release(client, resource);
1327 }
1328 catch(...)
1329 {
1330 ::mir::log(
1331 ::mir::logging::Severity::critical,
1332 "frontend:Wayland",
1333 std::current_exception(),
1334 "Exception processing Seat::release() request");
1335 }
839 }1336 }
8401337
841 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)1338 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
@@ -894,13 +1391,35 @@
894 {1391 {
895 surface_resolved = surface;1392 surface_resolved = surface;
896 }1393 }
897 me->set_cursor(serial, surface_resolved, hotspot_x, hotspot_y);1394 try
1395 {
1396 me->set_cursor(serial, surface_resolved, hotspot_x, hotspot_y);
1397 }
1398 catch(...)
1399 {
1400 ::mir::log(
1401 ::mir::logging::Severity::critical,
1402 "frontend:Wayland",
1403 std::current_exception(),
1404 "Exception processing Pointer::set_cursor() request");
1405 }
898 }1406 }
8991407
900 static void release_thunk(struct wl_client*, struct wl_resource* resource)1408 static void release_thunk(struct wl_client*, struct wl_resource* resource)
901 {1409 {
902 auto me = static_cast<Pointer*>(wl_resource_get_user_data(resource));1410 auto me = static_cast<Pointer*>(wl_resource_get_user_data(resource));
903 me->release();1411 try
1412 {
1413 me->release();
1414 }
1415 catch(...)
1416 {
1417 ::mir::log(
1418 ::mir::logging::Severity::critical,
1419 "frontend:Wayland",
1420 std::current_exception(),
1421 "Exception processing Pointer::release() request");
1422 }
904 }1423 }
9051424
906 static void resource_destroyed_thunk(wl_resource* us)1425 static void resource_destroyed_thunk(wl_resource* us)
@@ -941,7 +1460,18 @@
941 static void release_thunk(struct wl_client*, struct wl_resource* resource)1460 static void release_thunk(struct wl_client*, struct wl_resource* resource)
942 {1461 {
943 auto me = static_cast<Keyboard*>(wl_resource_get_user_data(resource));1462 auto me = static_cast<Keyboard*>(wl_resource_get_user_data(resource));
944 me->release();1463 try
1464 {
1465 me->release();
1466 }
1467 catch(...)
1468 {
1469 ::mir::log(
1470 ::mir::logging::Severity::critical,
1471 "frontend:Wayland",
1472 std::current_exception(),
1473 "Exception processing Keyboard::release() request");
1474 }
945 }1475 }
9461476
947 static void resource_destroyed_thunk(wl_resource* us)1477 static void resource_destroyed_thunk(wl_resource* us)
@@ -981,7 +1511,18 @@
981 static void release_thunk(struct wl_client*, struct wl_resource* resource)1511 static void release_thunk(struct wl_client*, struct wl_resource* resource)
982 {1512 {
983 auto me = static_cast<Touch*>(wl_resource_get_user_data(resource));1513 auto me = static_cast<Touch*>(wl_resource_get_user_data(resource));
984 me->release();1514 try
1515 {
1516 me->release();
1517 }
1518 catch(...)
1519 {
1520 ::mir::log(
1521 ::mir::logging::Severity::critical,
1522 "frontend:Wayland",
1523 std::current_exception(),
1524 "Exception processing Touch::release() request");
1525 }
985 }1526 }
9861527
987 static void resource_destroyed_thunk(wl_resource* us)1528 static void resource_destroyed_thunk(wl_resource* us)
@@ -1017,7 +1558,18 @@
1017 static void release_thunk(struct wl_client* client, struct wl_resource* resource)1558 static void release_thunk(struct wl_client* client, struct wl_resource* resource)
1018 {1559 {
1019 auto me = static_cast<Output*>(wl_resource_get_user_data(resource));1560 auto me = static_cast<Output*>(wl_resource_get_user_data(resource));
1020 me->release(client, resource);1561 try
1562 {
1563 me->release(client, resource);
1564 }
1565 catch(...)
1566 {
1567 ::mir::log(
1568 ::mir::logging::Severity::critical,
1569 "frontend:Wayland",
1570 std::current_exception(),
1571 "Exception processing Output::release() request");
1572 }
1021 }1573 }
10221574
1023 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)1575 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
@@ -1069,19 +1621,52 @@
1069 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)1621 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
1070 {1622 {
1071 auto me = static_cast<Region*>(wl_resource_get_user_data(resource));1623 auto me = static_cast<Region*>(wl_resource_get_user_data(resource));
1072 me->destroy();1624 try
1625 {
1626 me->destroy();
1627 }
1628 catch(...)
1629 {
1630 ::mir::log(
1631 ::mir::logging::Severity::critical,
1632 "frontend:Wayland",
1633 std::current_exception(),
1634 "Exception processing Region::destroy() request");
1635 }
1073 }1636 }
10741637
1075 static void add_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height)1638 static void add_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height)
1076 {1639 {
1077 auto me = static_cast<Region*>(wl_resource_get_user_data(resource));1640 auto me = static_cast<Region*>(wl_resource_get_user_data(resource));
1078 me->add(x, y, width, height);1641 try
1642 {
1643 me->add(x, y, width, height);
1644 }
1645 catch(...)
1646 {
1647 ::mir::log(
1648 ::mir::logging::Severity::critical,
1649 "frontend:Wayland",
1650 std::current_exception(),
1651 "Exception processing Region::add() request");
1652 }
1079 }1653 }
10801654
1081 static void subtract_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height)1655 static void subtract_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height)
1082 {1656 {
1083 auto me = static_cast<Region*>(wl_resource_get_user_data(resource));1657 auto me = static_cast<Region*>(wl_resource_get_user_data(resource));
1084 me->subtract(x, y, width, height);1658 try
1659 {
1660 me->subtract(x, y, width, height);
1661 }
1662 catch(...)
1663 {
1664 ::mir::log(
1665 ::mir::logging::Severity::critical,
1666 "frontend:Wayland",
1667 std::current_exception(),
1668 "Exception processing Region::subtract() request");
1669 }
1085 }1670 }
10861671
1087 static void resource_destroyed_thunk(wl_resource* us)1672 static void resource_destroyed_thunk(wl_resource* us)
@@ -1120,13 +1705,35 @@
1120 static void destroy_thunk(struct wl_client* client, struct wl_resource* resource)1705 static void destroy_thunk(struct wl_client* client, struct wl_resource* resource)
1121 {1706 {
1122 auto me = static_cast<Subcompositor*>(wl_resource_get_user_data(resource));1707 auto me = static_cast<Subcompositor*>(wl_resource_get_user_data(resource));
1123 me->destroy(client, resource);1708 try
1709 {
1710 me->destroy(client, resource);
1711 }
1712 catch(...)
1713 {
1714 ::mir::log(
1715 ::mir::logging::Severity::critical,
1716 "frontend:Wayland",
1717 std::current_exception(),
1718 "Exception processing Subcompositor::destroy() request");
1719 }
1124 }1720 }
11251721
1126 static void get_subsurface_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id, struct wl_resource* surface, struct wl_resource* parent)1722 static void get_subsurface_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id, struct wl_resource* surface, struct wl_resource* parent)
1127 {1723 {
1128 auto me = static_cast<Subcompositor*>(wl_resource_get_user_data(resource));1724 auto me = static_cast<Subcompositor*>(wl_resource_get_user_data(resource));
1129 me->get_subsurface(client, resource, id, surface, parent);1725 try
1726 {
1727 me->get_subsurface(client, resource, id, surface, parent);
1728 }
1729 catch(...)
1730 {
1731 ::mir::log(
1732 ::mir::logging::Severity::critical,
1733 "frontend:Wayland",
1734 std::current_exception(),
1735 "Exception processing Subcompositor::get_subsurface() request");
1736 }
1130 }1737 }
11311738
1132 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)1739 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
@@ -1182,37 +1789,103 @@
1182 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)1789 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
1183 {1790 {
1184 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));1791 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));
1185 me->destroy();1792 try
1793 {
1794 me->destroy();
1795 }
1796 catch(...)
1797 {
1798 ::mir::log(
1799 ::mir::logging::Severity::critical,
1800 "frontend:Wayland",
1801 std::current_exception(),
1802 "Exception processing Subsurface::destroy() request");
1803 }
1186 }1804 }
11871805
1188 static void set_position_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y)1806 static void set_position_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y)
1189 {1807 {
1190 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));1808 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));
1191 me->set_position(x, y);1809 try
1810 {
1811 me->set_position(x, y);
1812 }
1813 catch(...)
1814 {
1815 ::mir::log(
1816 ::mir::logging::Severity::critical,
1817 "frontend:Wayland",
1818 std::current_exception(),
1819 "Exception processing Subsurface::set_position() request");
1820 }
1192 }1821 }
11931822
1194 static void place_above_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* sibling)1823 static void place_above_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* sibling)
1195 {1824 {
1196 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));1825 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));
1197 me->place_above(sibling);1826 try
1827 {
1828 me->place_above(sibling);
1829 }
1830 catch(...)
1831 {
1832 ::mir::log(
1833 ::mir::logging::Severity::critical,
1834 "frontend:Wayland",
1835 std::current_exception(),
1836 "Exception processing Subsurface::place_above() request");
1837 }
1198 }1838 }
11991839
1200 static void place_below_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* sibling)1840 static void place_below_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* sibling)
1201 {1841 {
1202 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));1842 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));
1203 me->place_below(sibling);1843 try
1844 {
1845 me->place_below(sibling);
1846 }
1847 catch(...)
1848 {
1849 ::mir::log(
1850 ::mir::logging::Severity::critical,
1851 "frontend:Wayland",
1852 std::current_exception(),
1853 "Exception processing Subsurface::place_below() request");
1854 }
1204 }1855 }
12051856
1206 static void set_sync_thunk(struct wl_client*, struct wl_resource* resource)1857 static void set_sync_thunk(struct wl_client*, struct wl_resource* resource)
1207 {1858 {
1208 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));1859 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));
1209 me->set_sync();1860 try
1861 {
1862 me->set_sync();
1863 }
1864 catch(...)
1865 {
1866 ::mir::log(
1867 ::mir::logging::Severity::critical,
1868 "frontend:Wayland",
1869 std::current_exception(),
1870 "Exception processing Subsurface::set_sync() request");
1871 }
1210 }1872 }
12111873
1212 static void set_desync_thunk(struct wl_client*, struct wl_resource* resource)1874 static void set_desync_thunk(struct wl_client*, struct wl_resource* resource)
1213 {1875 {
1214 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));1876 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));
1215 me->set_desync();1877 try
1878 {
1879 me->set_desync();
1880 }
1881 catch(...)
1882 {
1883 ::mir::log(
1884 ::mir::logging::Severity::critical,
1885 "frontend:Wayland",
1886 std::current_exception(),
1887 "Exception processing Subsurface::set_desync() request");
1888 }
1216 }1889 }
12171890
1218 static void resource_destroyed_thunk(wl_resource* us)1891 static void resource_destroyed_thunk(wl_resource* us)
12191892
=== modified file 'src/server/frontend/wayland/wayland_connector.cpp'
--- src/server/frontend/wayland/wayland_connector.cpp 2017-09-26 21:47:42 +0000
+++ src/server/frontend/wayland/wayland_connector.cpp 2017-09-27 16:01:58 +0000
@@ -1875,7 +1875,19 @@
1875 while (!executor->workqueue.empty())1875 while (!executor->workqueue.empty())
1876 {1876 {
1877 auto work = std::move(executor->workqueue.front());1877 auto work = std::move(executor->workqueue.front());
1878 work();1878 try
1879 {
1880 work();
1881 }
1882 catch(...)
1883 {
1884 mir::log(
1885 mir::logging::Severity::critical,
1886 MIR_LOG_COMPONENT,
1887 std::current_exception(),
1888 "Exception processing Wayland event loop work item");
1889 }
1890
1879 executor->workqueue.pop_front();1891 executor->workqueue.pop_front();
1880 }1892 }
18811893

Subscribers

People subscribed via source and target branches