wayland: header order fixed, comment on controller member order
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>
Wed, 28 Jun 2017 14:33:53 +0000 (16:33 +0200)
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>
Tue, 8 Aug 2017 15:24:00 +0000 (17:24 +0200)
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
src/wayland.hpp

index 3516f5e..c47e218 100644 (file)
@@ -6,8 +6,8 @@
 #include "util.h"
 
 #include <functional>
-#include <memory>
 #include <unordered_map>
+#include <memory>
 #include <vector>
 
 //                      _                 _
@@ -228,6 +228,13 @@ struct screen : public wayland_proxy<struct ivi_controller_screen>,
 //  \___\___/|_| |_|\__|_|  \___/|_|_|\___|_|
 //
 struct controller : public wayland_proxy<struct ivi_controller> {
+   // HACK:
+   // The order of these member is mandatory, as when objects are destroyed
+   // they will call their parent (that's us right here!) and remove their
+   // proxy-to-id mapping. I.e. the *_proxy_to_id members need to be valid
+   // when the surfaces/layers/screens maps are destroyed. This sucks, but
+   // I cannot see a better solution w/o globals or some other horrible
+   // call-our-parent construct.
    std::unordered_map<uintptr_t, uint32_t> surface_proxy_to_id;
    std::unordered_map<uintptr_t, uint32_t> layer_proxy_to_id;
    std::unordered_map<uintptr_t, uint32_t> screen_proxy_to_id;