ObjFW  Diff

Differences From Artifact [e705f7e9ee]:

  • File src/OFApplication.m — part of check-in [e1e7ffa903] at 2011-09-22 23:25:42 on branch trunk — Exceptions are now autoreleased.

    This is safe as an "exception loop" can't happen, since if allocating
    an exception fails, it throws an OFAllocFailedException which is
    preallocated and can always be thrown.

    So, the worst case would be that an autorelease of an exception fails,
    triggering an OFOutOfMemoryException for which there is no memory,
    resulting in an OFAllocFailedException to be thrown. (user: js, size: 5271) [annotate] [blame] [check-ins using]

To Artifact [741469d176]:


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62


63
64
65
66
67
68
69
#endif

static OFApplication *app = nil;

static void
atexit_handler(void)
{
	id <OFApplicationDelegate> delegate = [app delegate];

	[delegate applicationWillTerminate];
}

int
of_application_main(int *argc, char **argv[], Class cls)
{
	OFApplication *app = [OFApplication sharedApplication];
	id <OFApplicationDelegate> delegate = [[cls alloc] init];

	[app setArgumentCount: argc
	    andArgumentValues: argv];

	[app setDelegate: delegate];
	[(id)delegate release];

	[app run];



	return 0;
}

@implementation OFApplication
+ sharedApplication
{







<
<
|












<


>
>







38
39
40
41
42
43
44


45
46
47
48
49
50
51
52
53
54
55
56
57

58
59
60
61
62
63
64
65
66
67
68
#endif

static OFApplication *app = nil;

static void
atexit_handler(void)
{


	[[app delegate] applicationWillTerminate];
}

int
of_application_main(int *argc, char **argv[], Class cls)
{
	OFApplication *app = [OFApplication sharedApplication];
	id <OFApplicationDelegate> delegate = [[cls alloc] init];

	[app setArgumentCount: argc
	    andArgumentValues: argv];

	[app setDelegate: delegate];


	[app run];

	[(id)delegate release];

	return 0;
}

@implementation OFApplication
+ sharedApplication
{
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
- (OFDictionary*)environment
{
	OF_GETTER(environment, YES)
}

- (id <OFApplicationDelegate>)delegate
{
	OF_GETTER(delegate, YES)
}

- (void)setDelegate: (id <OFApplicationDelegate>)delegate_
{
	OF_SETTER(delegate, delegate_, YES, NO)
}

- (void)run
{
	[delegate applicationDidFinishLaunching];
}








|




|







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
- (OFDictionary*)environment
{
	OF_GETTER(environment, YES)
}

- (id <OFApplicationDelegate>)delegate
{
	return delegate;
}

- (void)setDelegate: (id <OFApplicationDelegate>)delegate_
{
	delegate = delegate_;
}

- (void)run
{
	[delegate applicationDidFinishLaunching];
}

254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
	exit(status);
}

- (void)dealloc
{
	[arguments release];
	[environment release];
	[(id)delegate release];

	[super dealloc];
}
@end

@implementation OFObject (OFApplicationDelegate)
- (void)applicationDidFinishLaunching







<







253
254
255
256
257
258
259

260
261
262
263
264
265
266
	exit(status);
}

- (void)dealloc
{
	[arguments release];
	[environment release];


	[super dealloc];
}
@end

@implementation OFObject (OFApplicationDelegate)
- (void)applicationDidFinishLaunching