# HG changeset patch # User Chris Cannam # Date 1394027050 0 # Node ID 87512dacc4bd015e50ab2662135265893275d7d4 # Parent 558c71a802d46d34e784bf184d4be661900f475c Do not return a dormant layer as the currently-selected layer diff -r 558c71a802d4 -r 87512dacc4bd view/View.cpp --- a/view/View.cpp Wed Mar 05 13:04:09 2014 +0000 +++ b/view/View.cpp Wed Mar 05 13:44:10 2014 +0000 @@ -626,7 +626,15 @@ View::getSelectedLayer() { if (m_haveSelectedLayer && !m_layers.empty()) { - return getLayer(getLayerCount() - 1); + int n = getLayerCount(); + while (n > 0) { + --n; + Layer *layer = getLayer(n); + if (!(layer->isLayerDormant(this))) { + return layer; + } + } + return 0; } else { return 0; }