Composer hiding overlays ?

I’m writing an OOP Wrapper for Composer, or experimenting anyway. I have an oddity - I have three scenes - if I use them as scenes, it all works fine. If I use one of them as an overlay (e.g. use showOverlay() and hideOverlay() rather than gotoScene() to switch in and out, it works the first time but crashes the second time.

The problem appears to be that between the ‘before show’ and ‘after show’ a hide event occurs on the overlay scene, which causes a RTE as it hasn’t been shown (the wrapper converts this to a method call basically)

I can understand why this might happen if an Overlay is already open, as Composer hides it. But I have - I think - closed the overlay the first time, it goes away without any error messages.

-- --    Show an overlay. Has a similar construct to Goto Scene. -- function BaseScene:showOverlay(overlayName,options)     if options == nil then                                                           -- use class transition       options = self:getOverlayEffect(true)                                         -- get the effect       options.params = self:getOverlayParams()                                      -- add the parameters       options.params.isModal = self:isModalOverlay()                                -- and the isModal flag    end    print("Before show")    self:getComposer().showOverlay(overlayName,options)                              -- and show it.    print("After show")    self:getComposer().getScene(overlayName).\_\_OOOVparentInstance = self             -- record where we go back to.    self.\_\_isOverlayShown = true                                                     -- note it as shown. end -- --    Hide an Overlay - this is called from the overlays underlying parent, so you can (say) close an overlay after elapsed time. -- function BaseScene:hideOverlay()    if self.\_\_isOverlayShown then                                                    -- only hide if shown ....       print("Hiding overlay")       self.\_\_isOverlayShown = false                                                 -- after this it won't be.       local options = self:getOverlayEffect(false)                                  -- get the exit overlay       self:getComposer().hideOverlay(self:isRecyclableOverlay(),                    -- remove it.                                                             options.effect,options.time)    end end  

Ach, I feel so dim. I had forgotten to return true in the event handlers so they were propagating down the app and restarting the overlay before it had closed…

Ach, I feel so dim. I had forgotten to return true in the event handlers so they were propagating down the app and restarting the overlay before it had closed…