Skip to content

The Popup Button Demo SEGFAULTs in “-setMenu:” #73

@JanX2

Description

@JanX2

This is, because BTRPopUpButton causes “-setMenu:” to be called within “-initWithFrame:” (via BTRPopupButtonCommonInit() and [self addObserver:self forKeyPath:@"menu.delegate" options:NSKeyValueObservingOptionNew context:NULL];) and it in turn calls self.menu, which is not set yet and calls through to “-setMenu:” again, resulting in an infinite loop.

Apple strongly recommends to only use ivars directly in the -init… path for this exact reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions