aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-09-12 11:29:33 +0200
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-09-12 11:29:33 +0200
commitb7ce9433f275bd216751c120e8e80278f2492239 (patch)
treef6592d3eecfa7ca8815324b5040254b22a99999c /src
parent8dd66cc8d8f51e0f9bbec4d7529f83fcb36dff55 (diff)
app: check layer <-> surface assoc more thoroughly
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src')
-rw-r--r--src/app.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/app.cpp b/src/app.cpp
index c0cb100..d371af1 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -386,14 +386,20 @@ char const *App::activate_surface(char const *drawing_name) {
return "Surface does not exist in controller!";
}
- auto layer_id = *this->layers.get_layer_id(*surface_id);
+ auto layer_id = this->layers.get_layer_id(*surface_id);
+
+ if (! layer_id) {
+ logdebug("Surface %d has no associated layer!", *surface_id);
+ return "Surface is not on any layer!";
+ }
+
struct LayoutState &state = **this->layers.get_layout_state(*surface_id);
logdebug("state @ %p = { %d, %d, %d }", &state, state.main, state.sub, state.s);
// disable layers that are above our current layer
for (auto const &l : this->layers.mapping) {
- if (l.layer_id <= layer_id) {
+ if (l.layer_id <= *layer_id) {
continue;
}
@@ -545,7 +551,12 @@ char const *App::deactivate_surface(char const *drawing_name) {
// |_|
void App::surface_created(uint32_t surface_id) {
auto layer_id = this->layers.get_layer_id(surface_id);
- logdebug("surface_id is %u, layer_id is %u", surface_id, layer_id ? *layer_id : -1u);
+ if (! layer_id) {
+ logdebug("Newly created surfce %d is not associated with any layer!", surface_id);
+ return;
+ }
+
+ logdebug("surface_id is %u, layer_id is %u", surface_id, *layer_id);
this->controller->layers[*layer_id]
->add_surface(this->controller->surfaces[surface_id].get());