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

Uninitialized GSNotificationObserverClass can cause a crash #381

Closed
svgol opened this issue Mar 11, 2024 · 2 comments
Closed

Uninitialized GSNotificationObserverClass can cause a crash #381

svgol opened this issue Mar 11, 2024 · 2 comments

Comments

@svgol
Copy link
Contributor

svgol commented Mar 11, 2024

The -[NSNotificationCenter removeObserver:name:object:] has the following chunk around the line 1050 :

/* As a special case GSNotificationObserver instances are owned by the
 * notification center and are released when they are removed.
 */
if (object_getClass(observer) == GSNotificationObserverClass)
  {
    RELEASE(observer);
  }

If GSNotificationObserverClass is left unintialized (nil) then any attempt to remove an already deallocated observer leads to a crash. These bad conditions exist currently in libs-gui where NSTextView subscribes its delegate for text change notifications. When the delegate is deallocated before the NSTextView the latter would make the bad call -removeObserver:name:object: in its -dealloc resulting in a crash.

@svgol
Copy link
Contributor Author

svgol commented Mar 11, 2024

@rfm
Copy link
Contributor

rfm commented Mar 11, 2024

Thanks. Should be fixed in trunk now.

@rfm rfm closed this as completed Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants