ObjFW  Check-in [8aa77abadd]

Overview
Comment:OFObject: Free spinlock in dealloc
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8aa77abadd3b34101755d5e4e3bee9a7835b3c7c04910aaef6815bf6e5251763
User & Date: js on 2022-09-19 19:16:24
Other Links: manifest | tags
Context
2022-09-19
19:37
OFObject: Document exceptions check-in: ae55197d6b user: js tags: trunk
19:16
OFObject: Free spinlock in dealloc check-in: 8aa77abadd user: js tags: trunk
19:10
Fix missing void in function declarations check-in: 41c2b305ce user: js tags: trunk
Changes

Modified src/OFObject.m from [ed9d8357b8] to [1199f442fe].

328
329
330
331
332
333
334




335
336
337
338
339
340
341
		    exceptionWithClass: class];
	}
#endif

	instance = (OFObject *)(void *)((char *)instance + PRE_IVARS_ALIGN);

	if (!objc_constructInstance(class, instance)) {




		free((char *)instance - PRE_IVARS_ALIGN);
		@throw [OFInitializationFailedException
		    exceptionWithClass: class];
	}

	if OF_UNLIKELY (extra != NULL)
		*extra = (char *)instance + instanceSize + extraAlignment;







>
>
>
>







328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
		    exceptionWithClass: class];
	}
#endif

	instance = (OFObject *)(void *)((char *)instance + PRE_IVARS_ALIGN);

	if (!objc_constructInstance(class, instance)) {
#if !defined(OF_HAVE_ATOMIC_OPS) && !defined(OF_AMIGAOS)
		OFSpinlockFree(&((struct PreIvars *)(void *)
		    ((char *)instance - PRE_IVARS_ALIGN))->retainCountSpinlock);
#endif
		free((char *)instance - PRE_IVARS_ALIGN);
		@throw [OFInitializationFailedException
		    exceptionWithClass: class];
	}

	if OF_UNLIKELY (extra != NULL)
		*extra = (char *)instance + instanceSize + extraAlignment;
1198
1199
1200
1201
1202
1203
1204




1205
1206
1207
1208
1209
1210
1211

	return true;
}

- (void)dealloc
{
	objc_destructInstance(self);





	free((char *)self - PRE_IVARS_ALIGN);
}

/* Required to use properties with the Apple runtime */
- (id)copyWithZone: (void *)zone
{







>
>
>
>







1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219

	return true;
}

- (void)dealloc
{
	objc_destructInstance(self);

#if !defined(OF_HAVE_ATOMIC_OPS) && !defined(OF_AMIGAOS)
	OFSpinlockFree(&PRE_IVARS->retainCountSpinlock);
#endif

	free((char *)self - PRE_IVARS_ALIGN);
}

/* Required to use properties with the Apple runtime */
- (id)copyWithZone: (void *)zone
{