Material: Menu.hitTest calling itself infinitely

Created on 16 Feb 2017  路  4Comments  路  Source: CosmicMind/Material

When delegate is not set, or if delegate does not close the menu if isOutside == true, hitTest calls itself infinitely, leading to stack overflow.

I assume the last line should be return super.hitTest(point, with: event)

From iOS/Menu.swift

    open override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
        guard isOpened, isEnabled else {
            return super.hitTest(point, with: event)
        }

        for v in subviews {
            let p = v.convert(point, from: self)
            if v.bounds.contains(p) {
                delegate?.menu?(menu: self, tappedAt: point, isOutside: false)
                return v.hitTest(p, with: event)
            }
        }

        delegate?.menu?(menu: self, tappedAt: point, isOutside: true)

        return self.hitTest(point, with: event)
    }

I read you are working on a new Menu, FABMenu, so issue will possibly be moot by then.

bug help wanted

Most helpful comment

Hey, there is a fix for this already in the next major release. I am running through all the sample projects so that I could make the Material 2.5 release. The new menu is called FABMenu once released. I will leave this open until I release the next update.

All 4 comments

I noticed this is a duplicate of a closed issue (sorry, I only looked at open issues) #672

However, the fix implemented in development branch is to call close(), perhaps this should be up to the managing app (at least if delegate is set)?

Hey, there is a fix for this already in the next major release. I am running through all the sample projects so that I could make the Material 2.5 release. The new menu is called FABMenu once released. I will leave this open until I release the next update.

Hey, this should be fixed in Material 2.5.0 using the latest FABMenu. All the best!

Will definately check it out. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nthtrung09it picture nthtrung09it  路  5Comments

Dengekiko picture Dengekiko  路  3Comments

shshalom picture shshalom  路  4Comments

tskulbru picture tskulbru  路  6Comments

posaninagendra picture posaninagendra  路  4Comments