Commit graph

8729 commits

Author SHA1 Message Date
rfm
d6c1d36985 simplify life of charset 2024-12-19 21:02:44 +00:00
rfm
5aa5692768 Fix memory leaks 2024-12-19 19:18:18 +00:00
rfm
546ca94ede Merge remote-tracking branch 'origin/master' 2024-12-19 17:13:03 +00:00
rfm
5a150d8fa2 Be more careful to break retain cycles 2024-12-19 16:51:21 +00:00
rfm
1f0bac21e3 Fixups for old ABI. 2024-12-19 11:48:10 +00:00
rfm
d5da27bcbc Fix error unlinking old namespace 2024-12-19 11:37:59 +00:00
rfm
0d010003f9 Record detached document of a node and use that to fix memory leak. 2024-12-19 10:26:19 +00:00
Riccardo Mottola
a94dee4c0d try to resolve internal and external subset with functions 2024-12-18 22:44:05 +01:00
Hugo Melder
bde70572c9 GSFFIInvocation: Always use objc_msg_lookup
The current implementation skips hidden classes, which breaks KVO.
It turns out that GSGetMethod + method_getImplementation is about
50% slower than objc_msg_lookup (gnustep-2.2 ABI).
2024-12-13 03:29:30 -08:00
Hugo Melder
4b3bd1aa90
NSPointerArray: Implement fast enumeration (#477)
* NSPointerArray: Implement NSFastEnumeration

* NSPointerArray: Test for duplicate values in array

* NSPointerArray: Fast enumeration tests
2024-12-13 12:01:07 +01:00
rfm
4a4a802060 Set launch directory before AbsolutePathOfExecutable() needs it. 2024-12-08 13:40:59 +00:00
rfm
597d10d9cf Check for nil bundle identifier (eg early in initialization) 2024-12-07 16:22:20 +00:00
rfm
30d66f525b Fixes proposed by Frederick Seiffert 2024-12-07 16:20:28 +00:00
rfm
7c038fff64 Add debug of problems in finding absolute executable path 2024-12-06 21:45:55 +00:00
rfm
e7dd2f741a Don't assert inside lock protected region (could leave lock held). 2024-12-06 12:01:21 +00:00
rfm
476b4f75ec Fix error in inline array changes 2024-12-06 11:20:48 +00:00
rfm
a75d1c7b18 Add diagnositcs for faulure to get executable pathhhhhhhhhhhhhhhhhhhhhhhhh 2024-12-06 10:58:15 +00:00
rfm
eec5adb655 Add missing import 2024-12-05 12:39:46 +00:00
rfm
2de7793dbc copy cache key in case it is mutated 2024-12-04 19:43:45 +00:00
rfm
9ad13c4d24 fix typo 2024-12-04 16:01:04 +00:00
rfm
290f0d2f3a Do not use inline arrays with ASAN 2024-12-04 15:58:34 +00:00
rfm
932eb5e1c3 Use bundle identifier for dedaults domain if possible 2024-12-04 14:49:16 +00:00
rfm
4860310071 Tidied 2024-12-04 14:15:57 +00:00
rfm
a82e358248 Improve stack trace when tracking 2024-12-04 11:00:42 +00:00
rfm
815a0d7b20 Tidyups 2024-12-04 11:00:26 +00:00
rfm
7ac6931039 update for GNUSTEP_WITH_ASAN 2024-12-04 10:44:48 +00:00
rfm
9cdb4f98ba asan fixes for gcc and gnu runtime 2024-11-30 19:06:40 +00:00
rfm
018111efbb LeakSanitizer fixups for gcc and gnu runtime 2024-11-30 18:23:48 +00:00
rfm
077133dda3 Fix leaks 2024-11-29 17:45:30 +00:00
rfm
85888dc903 Fix bug when tracking instances of a class and its superclass 2024-11-29 17:44:31 +00:00
rfm
818041d014 Fix leaks 2024-11-29 14:34:22 +00:00
rfm
e6b425d532 Report tracked objects at exit 2024-11-29 14:33:56 +00:00
rfm
a1a3f42ec0 Make use of new KVO implementation configurable 2024-11-29 11:55:47 +00:00
rfm
672fe7f909 Changes to avoid recursion if NSLog() is called during NSUserDefaults initialisation 2024-11-29 10:42:40 +00:00
rfm
f371b8068e
Merge branch 'master' into master 2024-11-29 09:38:36 +00:00
rfm
b280b40a15 Merge branch 'atexit' 2024-11-28 11:48:39 +00:00
rfm
f2368086f4 A bit of re-ordering to try to avoid premature initialisation of NSUserDefaults. 2024-11-27 16:25:08 +00:00
rfm
168c2a4c90 fix a leak establishign a connection 2024-11-24 16:38:23 +00:00
rfm
7d4771ec2d add missing brackets 2024-11-22 06:27:57 +00:00
rfm
021812f43d Fix another leak 2024-11-22 06:18:44 +00:00
rfm
4c287f20b3 More regular expression leak fix changes ... use older code (plus fixes). 2024-11-21 21:05:34 +00:00
rfm
087716fffa Improve dagnostic method for memory leaks 2024-11-21 18:18:06 +00:00
rfm
65ae40722e Fix leak of autorelease pools 2024-11-21 14:35:54 +00:00
Matvii Jarosh
410b295b01 Add EdgeInsets missing function in value 2024-11-21 13:01:31 +02:00
rfm
7b77a2074a Workaround to avoid memory leak in ICU functions if we set NULL as destination. 2024-11-20 17:46:35 +00:00
rfm
91124f3247 Fix boundary error in replacement function 2024-11-20 17:46:08 +00:00
rfm
fff13fc7ac GSInlineArray seems to cause false positives with LeakSanitizer, so avoid it 2024-11-20 14:28:46 +00:00
rfm
2278c79f62 Add +trackOwnership method to trace tetain/release for objects of a class 2024-11-20 14:27:44 +00:00
rfm
da73bc5e9b Fix failure t unlock mutex 2024-11-19 19:15:08 +00:00
rfm
7965acc27b Make +atExit method honor the shoudl clean up setting 2024-11-19 18:10:07 +00:00
rfm
e0b37c4a1b
Merge branch 'master' into nsgeometry-missing-func 2024-11-19 14:10:12 +00:00
rfm
ebedfaf5c1 avoid a couple of compiler warnings 2024-11-19 12:57:59 +00:00
rfm
077e4646ab Fix reference cycle in absolute time zone and its detail 2024-11-19 10:58:37 +00:00
rfm
ef0569cd4a Rename method to better reflect what it actually does. 2024-11-19 09:20:06 +00:00
rfm
9207ab856f Fix leak when absolute time zones are stored in the name dictionary 2024-11-18 17:15:11 +00:00
Matvii Jarosh
20f7a294e8 Added many missing features to NSGeometry 2024-11-18 17:57:47 +02:00
rfm
eeff6e08a7 Correct the creation of the hash table used for absolute time zones. 2024-11-18 15:34:53 +00:00
rfm
96bbc05b18 More leak fixups 2024-11-17 21:41:43 +00:00
rfm
42fa1bf04a Protect against dealloc without init 2024-11-17 20:57:04 +00:00
rfm
598236d3ef prevent re-initialize 2024-11-17 17:01:19 +00:00
rfm
f12eabad50 Fixup for dealloc of uninitialised instances 2024-11-17 16:55:54 +00:00
rfm
75049ec22e Replace lost check 2024-11-17 16:50:16 +00:00
rfm
6a723e5a87 Fixes for dealloc when init has not been called. 2024-11-17 16:41:59 +00:00
rfm
65b9b55e01 Fix dealloc when init has not been called 2024-11-17 16:31:37 +00:00
rfm
cd3e69245d More leak management fixes 2024-11-17 16:16:46 +00:00
rfm
90082eccac Revert last change 2024-11-17 15:03:22 +00:00
rfm
7cff5fc106 Fix more leaks 2024-11-17 13:32:31 +00:00
rfm
0fb9739f21 Fix leaks and a possible buffer overrun 2024-11-17 12:55:55 +00:00
rfm
dc4fad2c47 Fix for dealloc without init 2024-11-17 11:27:41 +00:00
rfm
5b46efa8cd More leak fixes 2024-11-16 21:11:56 +00:00
rfm
d68e8be8ee Fix leaks 2024-11-16 15:45:38 +00:00
rfm
9573539795 Fix buffer overrun 2024-11-16 11:51:53 +00:00
rfm
1e5c30dc50 Avoid possible leak caused by exception during property list parsing 2024-11-16 11:51:53 +00:00
rfm
088b76bed1 Fix leaks 2024-11-15 21:21:41 +00:00
rfm
77c66e3d95 Fix leaks 2024-11-15 20:48:09 +00:00
rfm
8209fa428f Lazy initialisation of nonBase charset info to avoid recursion during startup 2024-11-15 18:47:45 +00:00
rfm
d7c9bdbce7 Fix nil to NULL 2024-11-15 18:35:41 +00:00
rfm
70b687d3fd Fix leak. 2024-11-15 16:00:01 +00:00
rfm
bdad4987ae Fix leaked FFI structure argument/returntype information 2024-11-15 15:43:47 +00:00
rfm
072c17f315 Add some consistecy checks 2024-11-15 12:28:14 +00:00
rfm
1536c24331 Fix buffer overrun 2024-11-15 12:20:05 +00:00
rfm
1c7e81dee1 Free 'leaked' memory at exit. 2024-11-14 18:57:05 +00:00
rfm
bb57918f70 Protect against dealloc before init 2024-11-14 17:57:55 +00:00
rfm
43484b2c34 Fix deallocation of placeholder strings at exit. 2024-11-14 16:18:26 +00:00
rfm
4185b687f2 fix little leak 2024-11-14 15:30:01 +00:00
rfm
8b0543571b Don't use deprecated +leak: method. 2024-11-14 14:56:28 +00:00
rfm
25505b2e67 Some more leak improvements 2024-11-14 14:45:05 +00:00
rfm
dd3367de3b atexit improvements 2024-11-14 12:52:43 +00:00
rfm
e64b7dc6b3 iuse bundle identifier for user defaults 2024-11-13 23:11:10 +00:00
rfm
b2e198cb0d Fix notification removal bug from last update 2024-11-12 15:08:06 +00:00
rfm
28ba7788ce Fix the case where we replace a value already in the map 2024-11-12 14:27:06 +00:00
rfm
b78b2e2030 hash/map table and pointer functions fixups 2024-11-12 12:03:24 +00:00
rfm
c981920679 Revert "Retain count fixes"
This reverts commit 544dcce482.
2024-11-10 20:13:39 +00:00
Hugo Melder
6681a3da47
Initial port of WinObjC's KVO implementation to GNUstep (#420)
* GSAtomic: Add prefix to macro definitions

* NSKVOSupport: Import

* NSKVOSupport: Add test cases

* NSKVOSwizzling: Ugly C Rewrite

* NSKeyValueObserving: Use old implementation as fallback

* NSKeyValueObserving: Rename TypeEncodingCases header

* NSKVOSupport: Fix new objects not being added to NSKeyValueChangeNew set on set mutation

* NSKeyValueMutableSet: Fix will and didChange notifications for set operations

* NSKeyValueMutableSet: Document Accessor Search Patterns

* NSKVOSupport: Add toMany test

* NSKeyValueCoding: Change notifications when changing value via setValue:forKey:

* NSKVOSupport: Add more tests

* NSKVOSupport: Do not wrap block in try/finally to avoid crash in windows

* NSKVOSwizzling: use _alloca on Windows

* NSKVOSupport: Do not autorelease newWithObservee:

* NSKVOSupport: Do not leak Observee and TestFacade objects

* Improve runtime detection in makefile

* Add file extension of source file in GNUMakefile

* NSKVOSupport: Remove @status comments

* NSKVOSupport: Implement private notify method

* NSUserDefaults: KVO Support and fix macOS incompatibilities

* NSKeyValueObserving: Set old to null if nil

* NSKeyValueObserving: Remove cached new value

* NSMethodSignature: Add signature cache

* NSKVOSupport: Remove ObjC2 features and mark tests failing on GCC as hopeful

* Call class method instead of private _keyPathsForValuesAffectingValueForKey

* Move _keyPathsForValuesAffectingValueForKey body into class method and statically construct empty NSSet

* NSUserDefaults: Change notification should contain old value from other domains aswell

* NSUserDefaults: Fetch new value from all domains

* NSKVOInternal: Fixup filename in header

* NSUserDefaults: Go through search list instead of only one domain in KVO change

* Making indentation a bit less worse

* Add NSUserDefaults KVO tests

* NSKVOSupport: NSUserDefaults test small fixes

* Add autoreleasepool

* NSUserDefaults: Only emit change notifications if value changed

* Avoid compiler warnings and tidy some of the whitespace/formatting

---------

Co-authored-by: Frederik Seiffert <frederik@algoriddim.com>
Co-authored-by: rfm <richardfrithmacdonald@gmail.com>
Co-authored-by: rfm <rfm@gnu.org>
2024-11-10 17:05:23 +01:00
rfm
544dcce482 Retain count fixes 2024-11-10 14:14:42 +00:00
rfm
44222342b0 Fix for issue 461 2024-11-09 11:09:22 +00:00
rfm
fe5efb6aa2 OSX 10.15 file offset methods 2024-11-08 15:19:40 +00:00
rfm
4961287024 issue 325 2024-11-08 11:52:27 +00:00
rfm
f180575e37 Fix for issue 459 2024-11-08 10:33:32 +00:00
rfm
b8d0003b43 Update FSF address as requested by Gregory 2024-11-08 10:33:32 +00:00
rfm
0271f62ab2 Fix for issue 452 2024-11-08 10:33:32 +00:00
rfm
ca84bde33b Add a bit of information about handler callback methods to comments/docs. 2024-11-08 10:33:32 +00:00
rfm
d0bff27c77 Tweaks to NSDate changes 2024-11-08 10:33:32 +00:00
rfm
7a59450341 Reapply "Implement NSDate as a small object (tagged pointer) - clang/libobjc2 only (#451)" because of GUI breakage: apps hang when loading NSMenu
This reverts commit cac43f7bfc.
2024-11-08 10:33:32 +00:00
Riccardo Mottola
fab621bb2d Revert "Implement NSDate as a small object (tagged pointer) - clang/libobjc2 only (#451)" because of GUI breakage: apps hang when loading NSMenu
This reverts commit 8fd2c06ddd.
2024-11-08 10:33:32 +00:00
Hugo Melder
d53a732576 NSThread: Implement +detatchThreadWithBlock: and -initWithBlock: (#454)
* NSThread: Implement +detatchThreadWithBlock: and -initWithBlock:

* Remove extraneous include

* NSThread: Define GSThreadBlock so that GCC stub impl does not fail

* Add missing spaces - trivial style fixup

---------

Co-authored-by: rfm <richardfrithmacdonald@gmail.com>
2024-11-08 10:33:32 +00:00
rfm
1ad65abdaa Fix for issue 453 2024-11-08 10:33:32 +00:00
Hugo Melder
ab5d06da6a NSKeyValueCoding: Safe-Caching for -[NSObject valueForKey:] (#445)
* KVC Caching Implementation

* Do not ignore struct name when comparing type encoding as NSPoint and NSSize have the same layout

* Use fast-path when using Objective-C 2

* Guard old ValueForKey function when using the fast-path

* Add basic NSKeyValueCoding tests

* Update Copyright Years

* NSKeyValueCoding+Caching: Add Versioning to IVar Slot

* safe_caching: Remove Guards

* Add type encoding helper header

* Rename geometry structs (NSRect, NSPoint, NSSize) for toll-free bridging with CoreGraphics

* Move CG struct definitions to CFCGTypes.h

* Update known struct encoding prefixes

* Windows 64-bit is LLP64 and not LP64

* Re-order to avoid complier warning

---------

Co-authored-by: rfm <richardfrithmacdonald@gmail.com>
2024-11-08 10:33:32 +00:00
rfm
3e55c3b296 safety fix in case code incorrectly tries to use the reuslt of forwarding a method to the undo manager. 2024-11-08 10:33:32 +00:00
Hugo Melder
f940412e0e NSString: Fix -commonPrefixWithString:options: behaviour (#455)
* Update changelog

* NSString: fix -commonPrefixWithString:options: behaviour

* NSString: More test cases
2024-11-08 10:33:32 +00:00
Hugo Melder
01b719f2af Implement NSDate as a small object (tagged pointer) - clang/libobjc2 only (#451)
* Implement GSSmallObject Class

* Remove private concrete class access

* Change secondary bias

* NSDate: Get interval from rhs object in comparison

* Add prefix to CONCRETE_CLASS_NAME  macro
2024-11-08 10:33:32 +00:00
rfm
0ad7e3f8ef Make files closer to gnustep coding style (automated fixups using uncrustify) 2024-11-08 10:33:32 +00:00
rfm
f6c0c5a5c0 Improve errors for copying. 2024-11-08 10:33:32 +00:00
Hugo Melder
3333d9fb73 NSString: Cache ICU collator in thread-local storage (#450)
* Add ICU collator caching

* Update ChangeLog
2024-11-08 10:33:32 +00:00
hmelder
4edbe633d4 Fix typo in ifdef 2024-11-08 10:33:32 +00:00
Hugo Melder
3c34150e05 NSOperationQueue: Proper names for worker threads (#437)
* NSOperationQueue: Give Worker Threads a name

* Update Changelog

* Remove empty string test
2024-11-08 10:33:32 +00:00
hmelder
7667d0c3c4 NSThread: Add warning when truncating thread name 2024-11-08 10:33:32 +00:00
Hugo Melder
b177fa5f01 Add Branch Prediction Macros and Error checks in Android Initialisation (#438)
* Add Branch Prediction Macros

* Rigorous Error Handling when using JNI
2024-11-08 10:33:32 +00:00
rfm
7c2ccb3035 avoid compiler warning 2024-11-08 10:33:32 +00:00
rfm
a1913e5540 NSURLSession rewrite (#422)
* clang-format: Do not use tabs

* Ignore clangd cache and compile_commands

* NSBlockOperation: Fix memory leak

* NSHTTPCookie: Fix expires date parsing

* NSHTTPCookie: Release DateFormatter after use

* NSOperation: Remove all objects at end of execution

* Reimplementation of NSURLSession

* NSURLSession: Update expiration dates in test

* Update ChangeLog

* Fix trivial compiler warning caused by missing import

* Import GSDispatch.h for definition of DISPATCH_QUEUE_SERIAL

* Import common.h early to avoid header conflict

* Fix import order to avoid conflicts and ensure we have correct localisation macro

* Check for presence of dispatch_cancel

* Cancel timer using dispatch_source_cancel() if dispatch_cancel() is missing.

* NSURLSession: Replace dispatch_io with dispatch_source in unit test HTTP server

---------

Co-authored-by: hmelder <service@hugomelder.com>
2024-11-08 10:33:32 +00:00
Hugo Melder
e3208590b1 NSThread: Fix threadPriority and setThreadPriority: on Android by using setpriority instead of pthread (#436)
* Update Changelog

* Use {get, set}priority for -[NSThread setThreadPriority] on Android
2024-11-08 10:33:32 +00:00
Earl Robsham
3e808dc173 Update -[NSMutableArray removeLastObject] (#433)
* Update `-[NSMutableArray removeLastObject]`

Updates the following implementation to avoid raising an exception if the array is already empty (or notifying observers if applicable):
 * `-[NSMutableArray removeLastObject]`
 * `-[GSMutableArray removeLastObject]`
 * `-[NSKeyValueMutableArray removeLastObject]`
 * `-[NSKeyValueIvarMutableArray removeLastObject]`

This brings the behavior of `-[NSMutableArray removeLastObject]` inline with the Apple implementation, improving compatibility for code bases which use both GNUStep and Apple objc/Foundation implementations.

* Add `-[NSMutableArray removeLastObject]` test case

Adds a test case to ensure `-[NSMutableArray removeLastObject]` does not raise an exception when called on an empty array.
2024-11-08 10:33:31 +00:00
rfm
c3b208a85a avoid compiler warning 2024-11-08 10:33:31 +00:00
rfm
7dfdabd675 Supply function pointer prototype to avoid compiler warnings 2024-11-08 10:33:31 +00:00
rfm
f162e0f97e Changes for index.html output 2024-10-21 20:55:21 +01:00
rfm
80216e6328 Don't override the default stylesheet 2024-09-16 19:36:28 +01:00
Hugo Melder
81b3c721bc
NSUserDefaults: Retrieve native UI languages from Windows and Android System APIs (#426)
* Create NSString Win32Additions Category

* NSUserDefaults: Fetch Windows UI language information

* NSUserDefaults: Add winnls include

* Android Native UI Language

* NSUserDefaults: Replace incorrect separator on Windows

* NSProcessInfo: BCP-47 Note

* GSConfig: Bump MinGW WINVER to Vista

* NSString+Win32Additions: Do not add array to arp twice

* NSUserDefaults: Increase default length
2024-08-07 16:26:16 +02:00
rfm
9bdad8d56b Add option to set stylesheet 2024-08-06 20:17:38 +01:00
rfm
6c43f6c831 iFixup trace function type/name 2024-08-06 20:17:05 +01:00
rfm
04f0d76904 Fix use of obsolete/deprecated method. 2024-07-31 10:24:04 +01:00
rfm
6d8f546c08 fix trivial typo 2024-07-31 10:22:48 +01:00
rfm
28a6e6ebbd Final batch of GC cleanups (for the forseeable future). 2024-07-25 17:11:34 +01:00
rfm
b49af95359 Hide internals of _NSZone struct for consistency with OSX 2024-07-23 13:06:24 +01:00
rfm
52c127c950 GC was deprecated several releases ago and notinally removed a couple of releases ago ... delete more remnants of the old code. 2024-07-22 15:14:13 +01:00
rfm
a1514249f3 Tweaks to match OSX pointer array behaviors more accurately. 2024-07-22 12:22:40 +01:00
rfm
5699959d39 zeroing weak memory is now treated as weak memory since GC has been dropped 2024-07-21 09:46:33 +01:00
rfm
c46d447100 Deprecate/remove old GC options 2024-07-21 09:16:09 +01:00
rfm
c435c6d7d6 Remove/update confusing comments. Separate acquire and assign operations for pointer functions. 2024-07-17 15:42:33 +01:00
rfm
2c1a993612 Update hadling of nil args to match OS-X 2024-07-17 11:32:01 +01:00
rfm
1a1e7f7fc5 Acquiring existing memory does not use a funtion on OSX, copy that behavior. 2024-07-16 19:43:28 +01:00
rfm
b677ea402a Add some simple pointer functions personality tests 2024-07-16 12:07:32 +01:00
rfm
4629a4e1f6 Tweaks related to issue #311 2024-07-15 17:19:16 +01:00
rfm
b91ff38636 issue 424 2024-07-09 17:03:39 +01:00
rfm
33e5b72a97 fix last modifiecation 2024-07-07 16:59:25 +01:00
rfm
9442ff8dac github issue 378 2024-07-07 13:56:20 +01:00
rfm
cb68ba8864 Make notification delivery a little more predictable (issue #423) 2024-07-04 11:48:58 +01:00
rfm
0cf5955e00 Avoid (some cases of) compiler warning; mixing declarations and code is incompatible with standards before C99 2024-07-03 16:21:13 +01:00
rfm
3fedf31c2d
Revert "NSURLSession Reimplementation (#411)"
This reverts commit 07233534e6.
2024-07-02 19:19:14 +01:00
Hugo Melder
07233534e6
NSURLSession Reimplementation (#411)
* clang-format: Do not use tabs

* Ignore clangd cache and compile_commands

* NSBlockOperation: Fix memory leak

* NSHTTPCookie: Fix expires date parsing

* NSOperation: Remove all objects at end of execution

* Reimplementation of NSURLSession

* Update ChangeLog
2024-07-02 15:58:48 +02:00
rfm
9367c2d796 use memory management notation for clang static analyzer 2024-06-23 10:35:16 +01:00