Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory handling of NSNotificationCenter observer object #362

Closed
wants to merge 1 commit into from

Conversation

triplef
Copy link
Member

@triplef triplef commented Jan 8, 2024

Fixes issue discussed in db90ab6.

@triplef triplef requested a review from rfm as a code owner January 8, 2024 20:27
Copy link
Contributor

@rfm rfm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's OK, but I have just written a more efficient version I was about to commit.
Almost the same code, but caching the class in a static variable

static Class GSNotificationObserverClass = Nil;

  • (void) initialize
    {
    if ([GSNotificationObserver class] == self)
    {
    GSNotificationObserverClass = self;
    }
    }
    and making the check be

    if (object_getClass(observer) == GSNotificationObserverClass)
    {
    RELEASE(observer);
    }

@triplef
Copy link
Member Author

triplef commented Jan 8, 2024

Ah nice, thank you! I’ll just wait for your commit then.

@triplef triplef closed this Jan 8, 2024
@triplef triplef deleted the fix-nsnotificationcenter-observer branch June 3, 2024 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants