Comments (4)
Internally, we use GSKeyPathExpression to get the key using Key-Value-Coding. When following the backtrace on lldb, you end up at the super class method of evaluateWithObject:
for whatever reasons.
In this case the predicate is parsed as a NSComparisonPredicate with a GSKeyPathExpression.
![image](https://private-user-images.githubusercontent.com/45601940/289306635-37ac71e8-dfd6-43af-b0f6-e01878c72d1c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTIxMTk5NTIsIm5iZiI6MTcxMjExOTY1MiwicGF0aCI6Ii80NTYwMTk0MC8yODkzMDY2MzUtMzdhYzcxZTgtZGZkNi00M2FmLWIwZjYtZTAxODc4YzcyZDFjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDAzVDA0NDczMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI1YWIwYjI4MzJiMzJjMzA3NDZkODkwODViNzE2YTZjNGE1ZTgzODkyOTE1MzE2ZmZmYWYwOTBlNjA3ZDUwZmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.VXE51t5lV771LVXJGfkH6L_6Uz0Cc7gHmH8hP2u3nWc)
TLDR:
This boils down to how we handle KVCoding with NSNull.
Given this test program:
#import <Foundation/Foundation.h>
int main(void) {
id obj = [[NSNull null] valueForKeyPath: @"key"];
NSLog(@"Output: %@", obj);
return 0;
}
The following is returned on macOS: 2023-12-09 19:32:08.434 a.out[6427:263545] Output: <null>
While on Debian with GNUstep:
![image](https://private-user-images.githubusercontent.com/45601940/289305689-af5214e5-a7c6-48be-bfa5-03feb79a8cb3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTIxMTk5NTIsIm5iZiI6MTcxMjExOTY1MiwicGF0aCI6Ii80NTYwMTk0MC8yODkzMDU2ODktYWY1MjE0ZTUtYTdjNi00OGJlLWJmYTUtMDNmZWI3OWE4Y2IzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDAzVDA0NDczMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE3NmJjODA5YzRjYzRiODg2OWQ3MDIxZGM4OTEwNWZhMjBkYjUzMTUwMWQ3MzAwMDAyYzBmZGYyYjg1Nzg2NTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.OJ_Hzu0qM8WBFAyiexIWnq4tNXfMKfOdgQziAuqs-iM)
from libs-base.
I managed to resolve the issue by overriding the valueForUndefinedKey method in NSNull. This prevents the triggering of the default handler, which typically results in an exception.
It seems that Apple uses a similar approach in their implementation.
from libs-base.
Fixed with #358
from libs-base.
Thank you for the fix!
from libs-base.
Related Issues (20)
- Notes for next Release (1.30.0) HOT 4
- [autogsdoc] cumulative issues
- NSBundle loads resources from the wrong version HOT 18
- awakeFromNib is implemented on NSObject (category in AppKit) and not on NSView HOT 1
- Avahi code doesn't compile HOT 2
- Failing tests on Alpine Linux HOT 25
- -[NSNotificationCenter addObserverForName:object:queue:usingBlock:] has a leak HOT 1
- Writing file atomically vs. not leads to different permissions HOT 8
- libasan detects leaks HOT 5
- NSJSONSerialization returns nil for certain strings with Unicode sequences HOT 2
- The second NSOperation added to an NSOperationQueue sometimes doesn't run until first operation is finished HOT 1
- Spurious NSURL test failures on Windows x64 MSVC HOT 7
- Exception when initializing NSLocale with dash-separated identifier HOT 2
- Deadlock and Increasing Memory Leak in NSURLConnection/test02 on Windows on ARM64 HOT 2
- Deadlock in NSUserDefaults HOT 3
- -[NSJSONSerialization JSONObjectWithStream:...] has a leak HOT 1
- NSRunLoop + dispatch_main_queue = 100% CPU --- SOLVED HOT 11
- Uninitialized GSNotificationObserverClass can cause a crash HOT 2
- Build error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libs-base.