diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-08 03:38:08 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-08 03:38:08 -0400 |
| commit | 4ab6251449b4c88869b12514f67c8731ab14c93c (patch) | |
| tree | 2d732d884cb8a8e4ada340ea423321ff17e35ad3 /new/uipriv_darwin.h | |
| parent | 5597606f188833979a7dbcf4a833e55e678f6e82 (diff) | |
Wrote up cleanup gunk on Mac OS X. Really gunk; I don't like what all this does but I don't think there's another way.
Diffstat (limited to 'new/uipriv_darwin.h')
| -rw-r--r-- | new/uipriv_darwin.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/new/uipriv_darwin.h b/new/uipriv_darwin.h index 514297c..5e8c82e 100644 --- a/new/uipriv_darwin.h +++ b/new/uipriv_darwin.h @@ -14,7 +14,7 @@ struct uiSizing { // TODO see if we can override alloc instead #ifdef uiLogAllocations #import <stdio.h> -#define uiLogObjCClassAllocations \ +#define uiLogObjCClassAllocations(deallocCode) \ + (id)alloc \ { \ id thing; \ @@ -24,15 +24,32 @@ struct uiSizing { } \ - (void)dealloc \ { \ + deallocCode \ [super dealloc]; \ fprintf(stderr, "%p free\n", self); \ } #else -#define uiLogObjCClassAllocations +#define uiLogObjCClassAllocations(deallocCode) \ +- (void)dealloc \ +{ \ + deallocCode \ + [super dealloc]; \ +} #endif // util_darwin.m extern void setStandardControlFont(NSControl *); +@protocol uiFreeOnDealloc +- (void)uiFreeOnDealloc:(void *)p; +@end +#define uiFreeOnDeallocImpl \ +- (void)uiFreeOnDealloc:(void *)p \ +{ \ + if (self.uiFreeList == nil) \ + self.uiFreeList = [NSMutableArray new]; \ + [self.uiFreeList addObject:[NSValue valueWIthPointer:p]]; \ +} +extern void uiDoFreeOnDealloc(NSMutableArray *); // container_darwin.m @interface uiContainer : NSView |
