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
1=== modified file 'include/common/mir/log.h'
2--- include/common/mir/log.h 2017-07-28 17:00:43 +0000
3+++ include/common/mir/log.h 2017-09-27 16:01:58 +0000
4@@ -34,6 +34,11 @@
5 char const* fmt, ...);
6 void log(logging::Severity sev, const char *component,
7 std::string const& message);
8+void log(
9+ logging::Severity sev,
10+ char const* component,
11+ std::exception_ptr const& exception,
12+ std::string const& message);
13
14 #ifndef MIR_LOG_COMPONENT
15 #ifdef MIR_LOG_COMPONENT_FALLBACK
16@@ -79,6 +84,13 @@
17 MIR_LOG_COMPONENT, message);
18 }
19
20+template<typename... Args>
21+void log_critical(char const* fmt, Args&&... args)
22+{
23+ ::mir::log(::mir::logging::Severity::critical,
24+ MIR_LOG_COMPONENT, fmt, std::forward<Args>(args)...);
25+}
26+
27 inline void log_error(std::string const& message)
28 {
29 ::mir::log(::mir::logging::Severity::error,
30@@ -97,7 +109,6 @@
31 ::mir::log(::mir::logging::Severity::warning,
32 MIR_LOG_COMPONENT, fmt, std::forward<Args>(args)...);
33 }
34-
35 } // (nested anonymous) namespace
36 #endif
37
38
39=== modified file 'src/common/log.cpp'
40--- src/common/log.cpp 2017-07-28 17:00:43 +0000
41+++ src/common/log.cpp 2017-09-27 16:01:58 +0000
42@@ -20,6 +20,9 @@
43 #include "mir/logging/logger.h"
44 #include <cstdio>
45
46+#include <exception>
47+#include <boost/exception/diagnostic_information.hpp>
48+
49 namespace mir {
50
51 void logv(logging::Severity sev, char const* component,
52@@ -51,4 +54,36 @@
53 logging::log(sev, message, component);
54 }
55
56+
57+void log(
58+ logging::Severity severity,
59+ char const* component,
60+ std::exception_ptr const& ex,
61+ std::string const& message)
62+{
63+ try
64+ {
65+ std::rethrow_exception(ex);
66+ }
67+ catch(std::exception const& err)
68+ {
69+ // TODO: We can probably format this better by pulling out
70+ // the boost::errinfo's ourselves.
71+ mir::log(
72+ severity,
73+ component,
74+ "%s: %s",
75+ message.c_str(),
76+ boost::diagnostic_information(err).c_str());
77+ }
78+ catch(...)
79+ {
80+ mir::log(
81+ severity,
82+ component,
83+ "%s: unknown exception",
84+ message.c_str());
85+ }
86+}
87+
88 } // namespace mir
89
90=== modified file 'src/protocol/wrapper_generator.cpp'
91--- src/protocol/wrapper_generator.cpp 2017-09-25 15:34:10 +0000
92+++ src/protocol/wrapper_generator.cpp 2017-09-27 16:01:58 +0000
93@@ -41,11 +41,13 @@
94 {
95 std::cout << "#include <experimental/optional>" << std::endl;
96 std::cout << "#include <boost/throw_exception.hpp>" << std::endl;
97+ std::cout << "#include <boost/exception/diagnostic_information.hpp>" << std::endl;
98 std::cout << std::endl;
99 std::cout << "#include <wayland-server.h>" << std::endl;
100 std::cout << "#include <wayland-server-protocol.h>" << std::endl;
101 std::cout << std::endl;
102 std::cout << "#include \"mir/fd.h\"" << std::endl;
103+ std::cout << "#include \"mir/log.h\"" << std::endl;
104 }
105
106 std::string strip_wl_prefix(std::string const& name)
107@@ -121,6 +123,20 @@
108 return false;
109 }
110
111+void emit_indented_lines(std::ostream& out, std::string const& indent,
112+ std::initializer_list<std::initializer_list<std::string>> lines)
113+{
114+ for (auto const& line : lines)
115+ {
116+ out << indent;
117+ for (auto const& fragment : line)
118+ {
119+ out << fragment;
120+ }
121+ out << std::endl;
122+ }
123+}
124+
125 class Interface;
126
127 class Argument
128@@ -216,15 +232,27 @@
129 }
130 out << ")" << std::endl;
131
132- out << indent << "{" << std::endl;
133- out << indent << " auto me = static_cast<" << interface_type << "*>("
134- << "wl_resource_get_user_data(resource));" << std::endl;
135+ emit_indented_lines(
136+ out,
137+ indent,
138+ {
139+ {"{"},
140+ {" auto me = static_cast<", interface_type, "*>(wl_resource_get_user_data(resource));"}
141+ });
142+
143 for (auto const& arg : arguments)
144 {
145 arg.emit_thunk_converter(out, indent + " ");
146 }
147
148- out << indent << " me->" << name << "(";
149+ emit_indented_lines(
150+ out,
151+ indent,
152+ {
153+ {" try"},
154+ {" {"},
155+ });
156+ out << indent << " me->" << name << "(";
157 if (is_global)
158 {
159 out << "client, resource";
160@@ -243,7 +271,21 @@
161 }
162 out << ");" << std::endl;
163
164- out << indent << "}" << std::endl;
165+ emit_indented_lines(
166+ out,
167+ indent,
168+ {
169+ {" }"},
170+ {" catch(...)"},
171+ {" {"},
172+ {" ::mir::log("},
173+ {" ::mir::logging::Severity::critical,"},
174+ {" \"frontend:Wayland\","},
175+ {" std::current_exception(),"},
176+ {" \"Exception processing ", interface_type, "::", name, "() request\");"},
177+ {" }"},
178+ {"}"}
179+ });
180 }
181
182 void emit_vtable_initialiser(std::ostream& out, std::string const& indent) const
183@@ -256,20 +298,6 @@
184 std::vector<Argument> arguments;
185 };
186
187-void emit_indented_lines(std::ostream& out, std::string const& indent,
188- std::initializer_list<std::initializer_list<std::string>> lines)
189-{
190- for (auto const& line : lines)
191- {
192- out << indent;
193- for (auto const& fragment : line)
194- {
195- out << fragment;
196- }
197- out << std::endl;
198- }
199-}
200-
201 class Interface
202 {
203 public:
204
205=== modified file 'src/server/frontend/wayland/core_generated_interfaces.h'
206--- src/server/frontend/wayland/core_generated_interfaces.h 2017-09-25 15:34:10 +0000
207+++ src/server/frontend/wayland/core_generated_interfaces.h 2017-09-27 16:01:58 +0000
208@@ -7,11 +7,13 @@
209
210 #include <experimental/optional>
211 #include <boost/throw_exception.hpp>
212+#include <boost/exception/diagnostic_information.hpp>
213
214 #include <wayland-server.h>
215 #include <wayland-server-protocol.h>
216
217 #include "mir/fd.h"
218+#include "mir/log.h"
219
220 namespace mir
221 {
222@@ -64,13 +66,35 @@
223 static void create_surface_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)
224 {
225 auto me = static_cast<Compositor*>(wl_resource_get_user_data(resource));
226- me->create_surface(client, resource, id);
227+ try
228+ {
229+ me->create_surface(client, resource, id);
230+ }
231+ catch(...)
232+ {
233+ ::mir::log(
234+ ::mir::logging::Severity::critical,
235+ "frontend:Wayland",
236+ std::current_exception(),
237+ "Exception processing Compositor::create_surface() request");
238+ }
239 }
240
241 static void create_region_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)
242 {
243 auto me = static_cast<Compositor*>(wl_resource_get_user_data(resource));
244- me->create_region(client, resource, id);
245+ try
246+ {
247+ me->create_region(client, resource, id);
248+ }
249+ catch(...)
250+ {
251+ ::mir::log(
252+ ::mir::logging::Severity::critical,
253+ "frontend:Wayland",
254+ std::current_exception(),
255+ "Exception processing Compositor::create_region() request");
256+ }
257 }
258
259 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
260@@ -123,19 +147,52 @@
261 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)
262 {
263 auto me = static_cast<ShmPool*>(wl_resource_get_user_data(resource));
264- me->create_buffer(id, offset, width, height, stride, format);
265+ try
266+ {
267+ me->create_buffer(id, offset, width, height, stride, format);
268+ }
269+ catch(...)
270+ {
271+ ::mir::log(
272+ ::mir::logging::Severity::critical,
273+ "frontend:Wayland",
274+ std::current_exception(),
275+ "Exception processing ShmPool::create_buffer() request");
276+ }
277 }
278
279 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
280 {
281 auto me = static_cast<ShmPool*>(wl_resource_get_user_data(resource));
282- me->destroy();
283+ try
284+ {
285+ me->destroy();
286+ }
287+ catch(...)
288+ {
289+ ::mir::log(
290+ ::mir::logging::Severity::critical,
291+ "frontend:Wayland",
292+ std::current_exception(),
293+ "Exception processing ShmPool::destroy() request");
294+ }
295 }
296
297 static void resize_thunk(struct wl_client*, struct wl_resource* resource, int32_t size)
298 {
299 auto me = static_cast<ShmPool*>(wl_resource_get_user_data(resource));
300- me->resize(size);
301+ try
302+ {
303+ me->resize(size);
304+ }
305+ catch(...)
306+ {
307+ ::mir::log(
308+ ::mir::logging::Severity::critical,
309+ "frontend:Wayland",
310+ std::current_exception(),
311+ "Exception processing ShmPool::resize() request");
312+ }
313 }
314
315 static void resource_destroyed_thunk(wl_resource* us)
316@@ -174,7 +231,18 @@
317 {
318 auto me = static_cast<Shm*>(wl_resource_get_user_data(resource));
319 mir::Fd fd_resolved{fd};
320- me->create_pool(client, resource, id, fd_resolved, size);
321+ try
322+ {
323+ me->create_pool(client, resource, id, fd_resolved, size);
324+ }
325+ catch(...)
326+ {
327+ ::mir::log(
328+ ::mir::logging::Severity::critical,
329+ "frontend:Wayland",
330+ std::current_exception(),
331+ "Exception processing Shm::create_pool() request");
332+ }
333 }
334
335 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
336@@ -224,7 +292,18 @@
337 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
338 {
339 auto me = static_cast<Buffer*>(wl_resource_get_user_data(resource));
340- me->destroy();
341+ try
342+ {
343+ me->destroy();
344+ }
345+ catch(...)
346+ {
347+ ::mir::log(
348+ ::mir::logging::Severity::critical,
349+ "frontend:Wayland",
350+ std::current_exception(),
351+ "Exception processing Buffer::destroy() request");
352+ }
353 }
354
355 static void resource_destroyed_thunk(wl_resource* us)
356@@ -273,32 +352,87 @@
357 {
358 mime_type_resolved = std::experimental::make_optional<std::string>(mime_type);
359 }
360- me->accept(serial, mime_type_resolved);
361+ try
362+ {
363+ me->accept(serial, mime_type_resolved);
364+ }
365+ catch(...)
366+ {
367+ ::mir::log(
368+ ::mir::logging::Severity::critical,
369+ "frontend:Wayland",
370+ std::current_exception(),
371+ "Exception processing DataOffer::accept() request");
372+ }
373 }
374
375 static void receive_thunk(struct wl_client*, struct wl_resource* resource, char const* mime_type, int fd)
376 {
377 auto me = static_cast<DataOffer*>(wl_resource_get_user_data(resource));
378 mir::Fd fd_resolved{fd};
379- me->receive(mime_type, fd_resolved);
380+ try
381+ {
382+ me->receive(mime_type, fd_resolved);
383+ }
384+ catch(...)
385+ {
386+ ::mir::log(
387+ ::mir::logging::Severity::critical,
388+ "frontend:Wayland",
389+ std::current_exception(),
390+ "Exception processing DataOffer::receive() request");
391+ }
392 }
393
394 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
395 {
396 auto me = static_cast<DataOffer*>(wl_resource_get_user_data(resource));
397- me->destroy();
398+ try
399+ {
400+ me->destroy();
401+ }
402+ catch(...)
403+ {
404+ ::mir::log(
405+ ::mir::logging::Severity::critical,
406+ "frontend:Wayland",
407+ std::current_exception(),
408+ "Exception processing DataOffer::destroy() request");
409+ }
410 }
411
412 static void finish_thunk(struct wl_client*, struct wl_resource* resource)
413 {
414 auto me = static_cast<DataOffer*>(wl_resource_get_user_data(resource));
415- me->finish();
416+ try
417+ {
418+ me->finish();
419+ }
420+ catch(...)
421+ {
422+ ::mir::log(
423+ ::mir::logging::Severity::critical,
424+ "frontend:Wayland",
425+ std::current_exception(),
426+ "Exception processing DataOffer::finish() request");
427+ }
428 }
429
430 static void set_actions_thunk(struct wl_client*, struct wl_resource* resource, uint32_t dnd_actions, uint32_t preferred_action)
431 {
432 auto me = static_cast<DataOffer*>(wl_resource_get_user_data(resource));
433- me->set_actions(dnd_actions, preferred_action);
434+ try
435+ {
436+ me->set_actions(dnd_actions, preferred_action);
437+ }
438+ catch(...)
439+ {
440+ ::mir::log(
441+ ::mir::logging::Severity::critical,
442+ "frontend:Wayland",
443+ std::current_exception(),
444+ "Exception processing DataOffer::set_actions() request");
445+ }
446 }
447
448 static void resource_destroyed_thunk(wl_resource* us)
449@@ -344,19 +478,52 @@
450 static void offer_thunk(struct wl_client*, struct wl_resource* resource, char const* mime_type)
451 {
452 auto me = static_cast<DataSource*>(wl_resource_get_user_data(resource));
453- me->offer(mime_type);
454+ try
455+ {
456+ me->offer(mime_type);
457+ }
458+ catch(...)
459+ {
460+ ::mir::log(
461+ ::mir::logging::Severity::critical,
462+ "frontend:Wayland",
463+ std::current_exception(),
464+ "Exception processing DataSource::offer() request");
465+ }
466 }
467
468 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
469 {
470 auto me = static_cast<DataSource*>(wl_resource_get_user_data(resource));
471- me->destroy();
472+ try
473+ {
474+ me->destroy();
475+ }
476+ catch(...)
477+ {
478+ ::mir::log(
479+ ::mir::logging::Severity::critical,
480+ "frontend:Wayland",
481+ std::current_exception(),
482+ "Exception processing DataSource::destroy() request");
483+ }
484 }
485
486 static void set_actions_thunk(struct wl_client*, struct wl_resource* resource, uint32_t dnd_actions)
487 {
488 auto me = static_cast<DataSource*>(wl_resource_get_user_data(resource));
489- me->set_actions(dnd_actions);
490+ try
491+ {
492+ me->set_actions(dnd_actions);
493+ }
494+ catch(...)
495+ {
496+ ::mir::log(
497+ ::mir::logging::Severity::critical,
498+ "frontend:Wayland",
499+ std::current_exception(),
500+ "Exception processing DataSource::set_actions() request");
501+ }
502 }
503
504 static void resource_destroyed_thunk(wl_resource* us)
505@@ -410,7 +577,18 @@
506 {
507 icon_resolved = icon;
508 }
509- me->start_drag(source_resolved, origin, icon_resolved, serial);
510+ try
511+ {
512+ me->start_drag(source_resolved, origin, icon_resolved, serial);
513+ }
514+ catch(...)
515+ {
516+ ::mir::log(
517+ ::mir::logging::Severity::critical,
518+ "frontend:Wayland",
519+ std::current_exception(),
520+ "Exception processing DataDevice::start_drag() request");
521+ }
522 }
523
524 static void set_selection_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* source, uint32_t serial)
525@@ -421,13 +599,35 @@
526 {
527 source_resolved = source;
528 }
529- me->set_selection(source_resolved, serial);
530+ try
531+ {
532+ me->set_selection(source_resolved, serial);
533+ }
534+ catch(...)
535+ {
536+ ::mir::log(
537+ ::mir::logging::Severity::critical,
538+ "frontend:Wayland",
539+ std::current_exception(),
540+ "Exception processing DataDevice::set_selection() request");
541+ }
542 }
543
544 static void release_thunk(struct wl_client*, struct wl_resource* resource)
545 {
546 auto me = static_cast<DataDevice*>(wl_resource_get_user_data(resource));
547- me->release();
548+ try
549+ {
550+ me->release();
551+ }
552+ catch(...)
553+ {
554+ ::mir::log(
555+ ::mir::logging::Severity::critical,
556+ "frontend:Wayland",
557+ std::current_exception(),
558+ "Exception processing DataDevice::release() request");
559+ }
560 }
561
562 static void resource_destroyed_thunk(wl_resource* us)
563@@ -466,13 +666,35 @@
564 static void create_data_source_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)
565 {
566 auto me = static_cast<DataDeviceManager*>(wl_resource_get_user_data(resource));
567- me->create_data_source(client, resource, id);
568+ try
569+ {
570+ me->create_data_source(client, resource, id);
571+ }
572+ catch(...)
573+ {
574+ ::mir::log(
575+ ::mir::logging::Severity::critical,
576+ "frontend:Wayland",
577+ std::current_exception(),
578+ "Exception processing DataDeviceManager::create_data_source() request");
579+ }
580 }
581
582 static void get_data_device_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id, struct wl_resource* seat)
583 {
584 auto me = static_cast<DataDeviceManager*>(wl_resource_get_user_data(resource));
585- me->get_data_device(client, resource, id, seat);
586+ try
587+ {
588+ me->get_data_device(client, resource, id, seat);
589+ }
590+ catch(...)
591+ {
592+ ::mir::log(
593+ ::mir::logging::Severity::critical,
594+ "frontend:Wayland",
595+ std::current_exception(),
596+ "Exception processing DataDeviceManager::get_data_device() request");
597+ }
598 }
599
600 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
601@@ -519,7 +741,18 @@
602 static void get_shell_surface_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id, struct wl_resource* surface)
603 {
604 auto me = static_cast<Shell*>(wl_resource_get_user_data(resource));
605- me->get_shell_surface(client, resource, id, surface);
606+ try
607+ {
608+ me->get_shell_surface(client, resource, id, surface);
609+ }
610+ catch(...)
611+ {
612+ ::mir::log(
613+ ::mir::logging::Severity::critical,
614+ "frontend:Wayland",
615+ std::current_exception(),
616+ "Exception processing Shell::get_shell_surface() request");
617+ }
618 }
619
620 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
621@@ -578,31 +811,86 @@
622 static void pong_thunk(struct wl_client*, struct wl_resource* resource, uint32_t serial)
623 {
624 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
625- me->pong(serial);
626+ try
627+ {
628+ me->pong(serial);
629+ }
630+ catch(...)
631+ {
632+ ::mir::log(
633+ ::mir::logging::Severity::critical,
634+ "frontend:Wayland",
635+ std::current_exception(),
636+ "Exception processing ShellSurface::pong() request");
637+ }
638 }
639
640 static void move_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* seat, uint32_t serial)
641 {
642 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
643- me->move(seat, serial);
644+ try
645+ {
646+ me->move(seat, serial);
647+ }
648+ catch(...)
649+ {
650+ ::mir::log(
651+ ::mir::logging::Severity::critical,
652+ "frontend:Wayland",
653+ std::current_exception(),
654+ "Exception processing ShellSurface::move() request");
655+ }
656 }
657
658 static void resize_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* seat, uint32_t serial, uint32_t edges)
659 {
660 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
661- me->resize(seat, serial, edges);
662+ try
663+ {
664+ me->resize(seat, serial, edges);
665+ }
666+ catch(...)
667+ {
668+ ::mir::log(
669+ ::mir::logging::Severity::critical,
670+ "frontend:Wayland",
671+ std::current_exception(),
672+ "Exception processing ShellSurface::resize() request");
673+ }
674 }
675
676 static void set_toplevel_thunk(struct wl_client*, struct wl_resource* resource)
677 {
678 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
679- me->set_toplevel();
680+ try
681+ {
682+ me->set_toplevel();
683+ }
684+ catch(...)
685+ {
686+ ::mir::log(
687+ ::mir::logging::Severity::critical,
688+ "frontend:Wayland",
689+ std::current_exception(),
690+ "Exception processing ShellSurface::set_toplevel() request");
691+ }
692 }
693
694 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)
695 {
696 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
697- me->set_transient(parent, x, y, flags);
698+ try
699+ {
700+ me->set_transient(parent, x, y, flags);
701+ }
702+ catch(...)
703+ {
704+ ::mir::log(
705+ ::mir::logging::Severity::critical,
706+ "frontend:Wayland",
707+ std::current_exception(),
708+ "Exception processing ShellSurface::set_transient() request");
709+ }
710 }
711
712 static void set_fullscreen_thunk(struct wl_client*, struct wl_resource* resource, uint32_t method, uint32_t framerate, struct wl_resource* output)
713@@ -613,13 +901,35 @@
714 {
715 output_resolved = output;
716 }
717- me->set_fullscreen(method, framerate, output_resolved);
718+ try
719+ {
720+ me->set_fullscreen(method, framerate, output_resolved);
721+ }
722+ catch(...)
723+ {
724+ ::mir::log(
725+ ::mir::logging::Severity::critical,
726+ "frontend:Wayland",
727+ std::current_exception(),
728+ "Exception processing ShellSurface::set_fullscreen() request");
729+ }
730 }
731
732 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)
733 {
734 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
735- me->set_popup(seat, serial, parent, x, y, flags);
736+ try
737+ {
738+ me->set_popup(seat, serial, parent, x, y, flags);
739+ }
740+ catch(...)
741+ {
742+ ::mir::log(
743+ ::mir::logging::Severity::critical,
744+ "frontend:Wayland",
745+ std::current_exception(),
746+ "Exception processing ShellSurface::set_popup() request");
747+ }
748 }
749
750 static void set_maximized_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* output)
751@@ -630,19 +940,52 @@
752 {
753 output_resolved = output;
754 }
755- me->set_maximized(output_resolved);
756+ try
757+ {
758+ me->set_maximized(output_resolved);
759+ }
760+ catch(...)
761+ {
762+ ::mir::log(
763+ ::mir::logging::Severity::critical,
764+ "frontend:Wayland",
765+ std::current_exception(),
766+ "Exception processing ShellSurface::set_maximized() request");
767+ }
768 }
769
770 static void set_title_thunk(struct wl_client*, struct wl_resource* resource, char const* title)
771 {
772 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
773- me->set_title(title);
774+ try
775+ {
776+ me->set_title(title);
777+ }
778+ catch(...)
779+ {
780+ ::mir::log(
781+ ::mir::logging::Severity::critical,
782+ "frontend:Wayland",
783+ std::current_exception(),
784+ "Exception processing ShellSurface::set_title() request");
785+ }
786 }
787
788 static void set_class_thunk(struct wl_client*, struct wl_resource* resource, char const* class_)
789 {
790 auto me = static_cast<ShellSurface*>(wl_resource_get_user_data(resource));
791- me->set_class(class_);
792+ try
793+ {
794+ me->set_class(class_);
795+ }
796+ catch(...)
797+ {
798+ ::mir::log(
799+ ::mir::logging::Severity::critical,
800+ "frontend:Wayland",
801+ std::current_exception(),
802+ "Exception processing ShellSurface::set_class() request");
803+ }
804 }
805
806 static void resource_destroyed_thunk(wl_resource* us)
807@@ -700,7 +1043,18 @@
808 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
809 {
810 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
811- me->destroy();
812+ try
813+ {
814+ me->destroy();
815+ }
816+ catch(...)
817+ {
818+ ::mir::log(
819+ ::mir::logging::Severity::critical,
820+ "frontend:Wayland",
821+ std::current_exception(),
822+ "Exception processing Surface::destroy() request");
823+ }
824 }
825
826 static void attach_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* buffer, int32_t x, int32_t y)
827@@ -711,19 +1065,52 @@
828 {
829 buffer_resolved = buffer;
830 }
831- me->attach(buffer_resolved, x, y);
832+ try
833+ {
834+ me->attach(buffer_resolved, x, y);
835+ }
836+ catch(...)
837+ {
838+ ::mir::log(
839+ ::mir::logging::Severity::critical,
840+ "frontend:Wayland",
841+ std::current_exception(),
842+ "Exception processing Surface::attach() request");
843+ }
844 }
845
846 static void damage_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height)
847 {
848 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
849- me->damage(x, y, width, height);
850+ try
851+ {
852+ me->damage(x, y, width, height);
853+ }
854+ catch(...)
855+ {
856+ ::mir::log(
857+ ::mir::logging::Severity::critical,
858+ "frontend:Wayland",
859+ std::current_exception(),
860+ "Exception processing Surface::damage() request");
861+ }
862 }
863
864 static void frame_thunk(struct wl_client*, struct wl_resource* resource, uint32_t callback)
865 {
866 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
867- me->frame(callback);
868+ try
869+ {
870+ me->frame(callback);
871+ }
872+ catch(...)
873+ {
874+ ::mir::log(
875+ ::mir::logging::Severity::critical,
876+ "frontend:Wayland",
877+ std::current_exception(),
878+ "Exception processing Surface::frame() request");
879+ }
880 }
881
882 static void set_opaque_region_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* region)
883@@ -734,7 +1121,18 @@
884 {
885 region_resolved = region;
886 }
887- me->set_opaque_region(region_resolved);
888+ try
889+ {
890+ me->set_opaque_region(region_resolved);
891+ }
892+ catch(...)
893+ {
894+ ::mir::log(
895+ ::mir::logging::Severity::critical,
896+ "frontend:Wayland",
897+ std::current_exception(),
898+ "Exception processing Surface::set_opaque_region() request");
899+ }
900 }
901
902 static void set_input_region_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* region)
903@@ -745,31 +1143,86 @@
904 {
905 region_resolved = region;
906 }
907- me->set_input_region(region_resolved);
908+ try
909+ {
910+ me->set_input_region(region_resolved);
911+ }
912+ catch(...)
913+ {
914+ ::mir::log(
915+ ::mir::logging::Severity::critical,
916+ "frontend:Wayland",
917+ std::current_exception(),
918+ "Exception processing Surface::set_input_region() request");
919+ }
920 }
921
922 static void commit_thunk(struct wl_client*, struct wl_resource* resource)
923 {
924 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
925- me->commit();
926+ try
927+ {
928+ me->commit();
929+ }
930+ catch(...)
931+ {
932+ ::mir::log(
933+ ::mir::logging::Severity::critical,
934+ "frontend:Wayland",
935+ std::current_exception(),
936+ "Exception processing Surface::commit() request");
937+ }
938 }
939
940 static void set_buffer_transform_thunk(struct wl_client*, struct wl_resource* resource, int32_t transform)
941 {
942 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
943- me->set_buffer_transform(transform);
944+ try
945+ {
946+ me->set_buffer_transform(transform);
947+ }
948+ catch(...)
949+ {
950+ ::mir::log(
951+ ::mir::logging::Severity::critical,
952+ "frontend:Wayland",
953+ std::current_exception(),
954+ "Exception processing Surface::set_buffer_transform() request");
955+ }
956 }
957
958 static void set_buffer_scale_thunk(struct wl_client*, struct wl_resource* resource, int32_t scale)
959 {
960 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
961- me->set_buffer_scale(scale);
962+ try
963+ {
964+ me->set_buffer_scale(scale);
965+ }
966+ catch(...)
967+ {
968+ ::mir::log(
969+ ::mir::logging::Severity::critical,
970+ "frontend:Wayland",
971+ std::current_exception(),
972+ "Exception processing Surface::set_buffer_scale() request");
973+ }
974 }
975
976 static void damage_buffer_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height)
977 {
978 auto me = static_cast<Surface*>(wl_resource_get_user_data(resource));
979- me->damage_buffer(x, y, width, height);
980+ try
981+ {
982+ me->damage_buffer(x, y, width, height);
983+ }
984+ catch(...)
985+ {
986+ ::mir::log(
987+ ::mir::logging::Severity::critical,
988+ "frontend:Wayland",
989+ std::current_exception(),
990+ "Exception processing Surface::damage_buffer() request");
991+ }
992 }
993
994 static void resource_destroyed_thunk(wl_resource* us)
995@@ -817,25 +1270,69 @@
996 static void get_pointer_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)
997 {
998 auto me = static_cast<Seat*>(wl_resource_get_user_data(resource));
999- me->get_pointer(client, resource, id);
1000+ try
1001+ {
1002+ me->get_pointer(client, resource, id);
1003+ }
1004+ catch(...)
1005+ {
1006+ ::mir::log(
1007+ ::mir::logging::Severity::critical,
1008+ "frontend:Wayland",
1009+ std::current_exception(),
1010+ "Exception processing Seat::get_pointer() request");
1011+ }
1012 }
1013
1014 static void get_keyboard_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)
1015 {
1016 auto me = static_cast<Seat*>(wl_resource_get_user_data(resource));
1017- me->get_keyboard(client, resource, id);
1018+ try
1019+ {
1020+ me->get_keyboard(client, resource, id);
1021+ }
1022+ catch(...)
1023+ {
1024+ ::mir::log(
1025+ ::mir::logging::Severity::critical,
1026+ "frontend:Wayland",
1027+ std::current_exception(),
1028+ "Exception processing Seat::get_keyboard() request");
1029+ }
1030 }
1031
1032 static void get_touch_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id)
1033 {
1034 auto me = static_cast<Seat*>(wl_resource_get_user_data(resource));
1035- me->get_touch(client, resource, id);
1036+ try
1037+ {
1038+ me->get_touch(client, resource, id);
1039+ }
1040+ catch(...)
1041+ {
1042+ ::mir::log(
1043+ ::mir::logging::Severity::critical,
1044+ "frontend:Wayland",
1045+ std::current_exception(),
1046+ "Exception processing Seat::get_touch() request");
1047+ }
1048 }
1049
1050 static void release_thunk(struct wl_client* client, struct wl_resource* resource)
1051 {
1052 auto me = static_cast<Seat*>(wl_resource_get_user_data(resource));
1053- me->release(client, resource);
1054+ try
1055+ {
1056+ me->release(client, resource);
1057+ }
1058+ catch(...)
1059+ {
1060+ ::mir::log(
1061+ ::mir::logging::Severity::critical,
1062+ "frontend:Wayland",
1063+ std::current_exception(),
1064+ "Exception processing Seat::release() request");
1065+ }
1066 }
1067
1068 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
1069@@ -894,13 +1391,35 @@
1070 {
1071 surface_resolved = surface;
1072 }
1073- me->set_cursor(serial, surface_resolved, hotspot_x, hotspot_y);
1074+ try
1075+ {
1076+ me->set_cursor(serial, surface_resolved, hotspot_x, hotspot_y);
1077+ }
1078+ catch(...)
1079+ {
1080+ ::mir::log(
1081+ ::mir::logging::Severity::critical,
1082+ "frontend:Wayland",
1083+ std::current_exception(),
1084+ "Exception processing Pointer::set_cursor() request");
1085+ }
1086 }
1087
1088 static void release_thunk(struct wl_client*, struct wl_resource* resource)
1089 {
1090 auto me = static_cast<Pointer*>(wl_resource_get_user_data(resource));
1091- me->release();
1092+ try
1093+ {
1094+ me->release();
1095+ }
1096+ catch(...)
1097+ {
1098+ ::mir::log(
1099+ ::mir::logging::Severity::critical,
1100+ "frontend:Wayland",
1101+ std::current_exception(),
1102+ "Exception processing Pointer::release() request");
1103+ }
1104 }
1105
1106 static void resource_destroyed_thunk(wl_resource* us)
1107@@ -941,7 +1460,18 @@
1108 static void release_thunk(struct wl_client*, struct wl_resource* resource)
1109 {
1110 auto me = static_cast<Keyboard*>(wl_resource_get_user_data(resource));
1111- me->release();
1112+ try
1113+ {
1114+ me->release();
1115+ }
1116+ catch(...)
1117+ {
1118+ ::mir::log(
1119+ ::mir::logging::Severity::critical,
1120+ "frontend:Wayland",
1121+ std::current_exception(),
1122+ "Exception processing Keyboard::release() request");
1123+ }
1124 }
1125
1126 static void resource_destroyed_thunk(wl_resource* us)
1127@@ -981,7 +1511,18 @@
1128 static void release_thunk(struct wl_client*, struct wl_resource* resource)
1129 {
1130 auto me = static_cast<Touch*>(wl_resource_get_user_data(resource));
1131- me->release();
1132+ try
1133+ {
1134+ me->release();
1135+ }
1136+ catch(...)
1137+ {
1138+ ::mir::log(
1139+ ::mir::logging::Severity::critical,
1140+ "frontend:Wayland",
1141+ std::current_exception(),
1142+ "Exception processing Touch::release() request");
1143+ }
1144 }
1145
1146 static void resource_destroyed_thunk(wl_resource* us)
1147@@ -1017,7 +1558,18 @@
1148 static void release_thunk(struct wl_client* client, struct wl_resource* resource)
1149 {
1150 auto me = static_cast<Output*>(wl_resource_get_user_data(resource));
1151- me->release(client, resource);
1152+ try
1153+ {
1154+ me->release(client, resource);
1155+ }
1156+ catch(...)
1157+ {
1158+ ::mir::log(
1159+ ::mir::logging::Severity::critical,
1160+ "frontend:Wayland",
1161+ std::current_exception(),
1162+ "Exception processing Output::release() request");
1163+ }
1164 }
1165
1166 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
1167@@ -1069,19 +1621,52 @@
1168 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
1169 {
1170 auto me = static_cast<Region*>(wl_resource_get_user_data(resource));
1171- me->destroy();
1172+ try
1173+ {
1174+ me->destroy();
1175+ }
1176+ catch(...)
1177+ {
1178+ ::mir::log(
1179+ ::mir::logging::Severity::critical,
1180+ "frontend:Wayland",
1181+ std::current_exception(),
1182+ "Exception processing Region::destroy() request");
1183+ }
1184 }
1185
1186 static void add_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height)
1187 {
1188 auto me = static_cast<Region*>(wl_resource_get_user_data(resource));
1189- me->add(x, y, width, height);
1190+ try
1191+ {
1192+ me->add(x, y, width, height);
1193+ }
1194+ catch(...)
1195+ {
1196+ ::mir::log(
1197+ ::mir::logging::Severity::critical,
1198+ "frontend:Wayland",
1199+ std::current_exception(),
1200+ "Exception processing Region::add() request");
1201+ }
1202 }
1203
1204 static void subtract_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height)
1205 {
1206 auto me = static_cast<Region*>(wl_resource_get_user_data(resource));
1207- me->subtract(x, y, width, height);
1208+ try
1209+ {
1210+ me->subtract(x, y, width, height);
1211+ }
1212+ catch(...)
1213+ {
1214+ ::mir::log(
1215+ ::mir::logging::Severity::critical,
1216+ "frontend:Wayland",
1217+ std::current_exception(),
1218+ "Exception processing Region::subtract() request");
1219+ }
1220 }
1221
1222 static void resource_destroyed_thunk(wl_resource* us)
1223@@ -1120,13 +1705,35 @@
1224 static void destroy_thunk(struct wl_client* client, struct wl_resource* resource)
1225 {
1226 auto me = static_cast<Subcompositor*>(wl_resource_get_user_data(resource));
1227- me->destroy(client, resource);
1228+ try
1229+ {
1230+ me->destroy(client, resource);
1231+ }
1232+ catch(...)
1233+ {
1234+ ::mir::log(
1235+ ::mir::logging::Severity::critical,
1236+ "frontend:Wayland",
1237+ std::current_exception(),
1238+ "Exception processing Subcompositor::destroy() request");
1239+ }
1240 }
1241
1242 static void get_subsurface_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id, struct wl_resource* surface, struct wl_resource* parent)
1243 {
1244 auto me = static_cast<Subcompositor*>(wl_resource_get_user_data(resource));
1245- me->get_subsurface(client, resource, id, surface, parent);
1246+ try
1247+ {
1248+ me->get_subsurface(client, resource, id, surface, parent);
1249+ }
1250+ catch(...)
1251+ {
1252+ ::mir::log(
1253+ ::mir::logging::Severity::critical,
1254+ "frontend:Wayland",
1255+ std::current_exception(),
1256+ "Exception processing Subcompositor::get_subsurface() request");
1257+ }
1258 }
1259
1260 static void bind(struct wl_client* client, void* data, uint32_t version, uint32_t id)
1261@@ -1182,37 +1789,103 @@
1262 static void destroy_thunk(struct wl_client*, struct wl_resource* resource)
1263 {
1264 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));
1265- me->destroy();
1266+ try
1267+ {
1268+ me->destroy();
1269+ }
1270+ catch(...)
1271+ {
1272+ ::mir::log(
1273+ ::mir::logging::Severity::critical,
1274+ "frontend:Wayland",
1275+ std::current_exception(),
1276+ "Exception processing Subsurface::destroy() request");
1277+ }
1278 }
1279
1280 static void set_position_thunk(struct wl_client*, struct wl_resource* resource, int32_t x, int32_t y)
1281 {
1282 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));
1283- me->set_position(x, y);
1284+ try
1285+ {
1286+ me->set_position(x, y);
1287+ }
1288+ catch(...)
1289+ {
1290+ ::mir::log(
1291+ ::mir::logging::Severity::critical,
1292+ "frontend:Wayland",
1293+ std::current_exception(),
1294+ "Exception processing Subsurface::set_position() request");
1295+ }
1296 }
1297
1298 static void place_above_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* sibling)
1299 {
1300 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));
1301- me->place_above(sibling);
1302+ try
1303+ {
1304+ me->place_above(sibling);
1305+ }
1306+ catch(...)
1307+ {
1308+ ::mir::log(
1309+ ::mir::logging::Severity::critical,
1310+ "frontend:Wayland",
1311+ std::current_exception(),
1312+ "Exception processing Subsurface::place_above() request");
1313+ }
1314 }
1315
1316 static void place_below_thunk(struct wl_client*, struct wl_resource* resource, struct wl_resource* sibling)
1317 {
1318 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));
1319- me->place_below(sibling);
1320+ try
1321+ {
1322+ me->place_below(sibling);
1323+ }
1324+ catch(...)
1325+ {
1326+ ::mir::log(
1327+ ::mir::logging::Severity::critical,
1328+ "frontend:Wayland",
1329+ std::current_exception(),
1330+ "Exception processing Subsurface::place_below() request");
1331+ }
1332 }
1333
1334 static void set_sync_thunk(struct wl_client*, struct wl_resource* resource)
1335 {
1336 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));
1337- me->set_sync();
1338+ try
1339+ {
1340+ me->set_sync();
1341+ }
1342+ catch(...)
1343+ {
1344+ ::mir::log(
1345+ ::mir::logging::Severity::critical,
1346+ "frontend:Wayland",
1347+ std::current_exception(),
1348+ "Exception processing Subsurface::set_sync() request");
1349+ }
1350 }
1351
1352 static void set_desync_thunk(struct wl_client*, struct wl_resource* resource)
1353 {
1354 auto me = static_cast<Subsurface*>(wl_resource_get_user_data(resource));
1355- me->set_desync();
1356+ try
1357+ {
1358+ me->set_desync();
1359+ }
1360+ catch(...)
1361+ {
1362+ ::mir::log(
1363+ ::mir::logging::Severity::critical,
1364+ "frontend:Wayland",
1365+ std::current_exception(),
1366+ "Exception processing Subsurface::set_desync() request");
1367+ }
1368 }
1369
1370 static void resource_destroyed_thunk(wl_resource* us)
1371
1372=== modified file 'src/server/frontend/wayland/wayland_connector.cpp'
1373--- src/server/frontend/wayland/wayland_connector.cpp 2017-09-26 21:47:42 +0000
1374+++ src/server/frontend/wayland/wayland_connector.cpp 2017-09-27 16:01:58 +0000
1375@@ -1875,7 +1875,19 @@
1376 while (!executor->workqueue.empty())
1377 {
1378 auto work = std::move(executor->workqueue.front());
1379- work();
1380+ try
1381+ {
1382+ work();
1383+ }
1384+ catch(...)
1385+ {
1386+ mir::log(
1387+ mir::logging::Severity::critical,
1388+ MIR_LOG_COMPONENT,
1389+ std::current_exception(),
1390+ "Exception processing Wayland event loop work item");
1391+ }
1392+
1393 executor->workqueue.pop_front();
1394 }
1395

Subscribers

People subscribed via source and target branches