@@ -138,7 +138,6 @@ static int wait_for_stdin(void)
138
138
}
139
139
140
140
NSEvent * event;
141
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init ];
142
141
while (true ) {
143
142
while (true ) {
144
143
event = [NSApp nextEventMatchingMask: NSAnyEventMask
@@ -151,7 +150,6 @@ static int wait_for_stdin(void)
151
150
CFRunLoopRun ();
152
151
if (interrupted || CFReadStreamHasBytesAvailable (stream)) break ;
153
152
}
154
- [pool release ];
155
153
156
154
if (py_sigint_handler) PyOS_setsig (SIGINT, py_sigint_handler);
157
155
CFReadStreamUnscheduleFromRunLoop (stream,
@@ -280,15 +278,13 @@ static void lazy_init(void) {
280
278
PyOS_InputHook = wait_for_stdin;
281
279
#endif
282
280
283
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init ];
284
281
WindowServerConnectionManager* connectionManager = [WindowServerConnectionManager sharedManager ];
285
282
NSWorkspace * workspace = [NSWorkspace sharedWorkspace ];
286
283
NSNotificationCenter * notificationCenter = [workspace notificationCenter ];
287
284
[notificationCenter addObserver: connectionManager
288
285
selector: @selector (launch: )
289
286
name: NSWorkspaceDidLaunchApplicationNotification
290
287
object: nil ];
291
- [pool release ];
292
288
}
293
289
294
290
static PyObject*
@@ -366,11 +362,7 @@ static CGFloat _get_device_scale(CGContextRef cr)
366
362
367
363
if (view) /* The figure may have been closed already */
368
364
{
369
- /* Whereas drawRect creates its own autorelease pool, apparently
370
- * [view display] also needs one. Create and release it here. */
371
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init ];
372
365
[view display ];
373
- [pool release ];
374
366
}
375
367
376
368
Py_RETURN_NONE;
@@ -546,7 +538,6 @@ static CGFloat _get_device_scale(CGContextRef cr)
546
538
close (channel[0 ]);
547
539
}
548
540
549
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init ];
550
541
NSDate * date =
551
542
(timeout > 0.0 ) ? [NSDate dateWithTimeIntervalSinceNow: timeout]
552
543
: [NSDate distantFuture ];
@@ -558,7 +549,6 @@ static CGFloat _get_device_scale(CGContextRef cr)
558
549
if (!event || [event type ]==NSApplicationDefined ) break ;
559
550
[NSApp sendEvent: event];
560
551
}
561
- [pool release ];
562
552
563
553
if (py_sigint_handler) PyOS_setsig (SIGINT, py_sigint_handler);
564
554
@@ -731,7 +721,6 @@ static CGFloat _get_device_scale(CGContextRef cr)
731
721
rect.size .height = height;
732
722
rect.size .width = width;
733
723
734
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init ];
735
724
self->window = [self ->window initWithContentRect: rect
736
725
styleMask: NSTitledWindowMask
737
726
| NSClosableWindowMask
@@ -749,7 +738,6 @@ static CGFloat _get_device_scale(CGContextRef cr)
749
738
[window makeFirstResponder: view];
750
739
[[window contentView ] addSubview: view];
751
740
752
- [pool release ];
753
741
return 0 ;
754
742
}
755
743
@@ -766,9 +754,7 @@ static CGFloat _get_device_scale(CGContextRef cr)
766
754
Window* window = self->window ;
767
755
if (window)
768
756
{
769
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init ];
770
757
[window close ];
771
- [pool release ];
772
758
}
773
759
Py_TYPE (self)->tp_free ((PyObject*)self);
774
760
}
@@ -779,10 +765,8 @@ static CGFloat _get_device_scale(CGContextRef cr)
779
765
Window* window = self->window ;
780
766
if (window)
781
767
{
782
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init ];
783
768
[window makeKeyAndOrderFront: nil ];
784
769
[window orderFrontRegardless ];
785
- [pool release ];
786
770
}
787
771
Py_RETURN_NONE;
788
772
}
@@ -793,9 +777,7 @@ static CGFloat _get_device_scale(CGContextRef cr)
793
777
Window* window = self->window ;
794
778
if (window)
795
779
{
796
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init ];
797
780
[window close ];
798
- [pool release ];
799
781
self->window = NULL ;
800
782
}
801
783
Py_RETURN_NONE;
@@ -812,12 +794,10 @@ static CGFloat _get_device_scale(CGContextRef cr)
812
794
Window* window = self->window ;
813
795
if (window)
814
796
{
815
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init ];
816
797
NSString * ns_title = [[[NSString alloc ]
817
798
initWithCString: title
818
799
encoding: NSUTF8StringEncoding] autorelease ];
819
800
[window setTitle: ns_title];
820
- [pool release ];
821
801
}
822
802
Py_RETURN_NONE;
823
803
}
@@ -829,13 +809,11 @@ static CGFloat _get_device_scale(CGContextRef cr)
829
809
PyObject* result = NULL ;
830
810
if (window)
831
811
{
832
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init ];
833
812
NSString * title = [window title ];
834
813
if (title) {
835
814
const char * cTitle = [title UTF8String ];
836
815
result = PyUnicode_FromString (cTitle);
837
816
}
838
- [pool release ];
839
817
}
840
818
if (result) {
841
819
return result;
@@ -1164,7 +1142,6 @@ -(void)save_figure:(id)sender
1164
1142
1165
1143
if (!PyArg_ParseTuple (args, " s" , &basedir)) return -1 ;
1166
1144
1167
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init ];
1168
1145
NSRect bounds = [view bounds ];
1169
1146
NSWindow * window = [view window ];
1170
1147
@@ -1265,8 +1242,6 @@ -(void)save_figure:(id)sender
1265
1242
[messagebox release ];
1266
1243
[[window contentView ] display ];
1267
1244
1268
- [pool release ];
1269
-
1270
1245
self->messagebox = messagebox;
1271
1246
return 0 ;
1272
1247
}
@@ -1297,10 +1272,9 @@ -(void)save_figure:(id)sender
1297
1272
NSText * messagebox = self->messagebox ;
1298
1273
1299
1274
if (messagebox)
1300
- { NSAutoreleasePool * pool = [[ NSAutoreleasePool alloc ] init ];
1275
+ {
1301
1276
NSString * text = [NSString stringWithUTF8String: message];
1302
1277
[messagebox setString: text];
1303
- [pool release ];
1304
1278
}
1305
1279
1306
1280
Py_RETURN_NONE;
@@ -2349,14 +2323,12 @@ - (int)index
2349
2323
show (PyObject* self)
2350
2324
{
2351
2325
[NSApp activateIgnoringOtherApps: YES ];
2352
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init ];
2353
2326
NSArray *windowsArray = [NSApp windows ];
2354
2327
NSEnumerator *enumerator = [windowsArray objectEnumerator ];
2355
2328
NSWindow *window;
2356
2329
while ((window = [enumerator nextObject ])) {
2357
2330
[window orderFront: nil ];
2358
2331
}
2359
- [pool release ];
2360
2332
Py_BEGIN_ALLOW_THREADS
2361
2333
[NSApp run ];
2362
2334
Py_END_ALLOW_THREADS
0 commit comments