@@ -200,6 +200,10 @@ static inline void
200200 if ( ! self )
201201 return ;
202202
203+ // proetection against wrap-around to root meta, which then clobbers
204+ // the runtime struct !
205+ assert ( _mulle_objc_class_is_infraclass ( _mulle_objc_object_get_isa ( self )));
206+
203207 if ( strategy & mulle_objc_property_accessor_copy )
204208 {
205209 if ( strategy & mulle_objc_property_accessor_mutable_copy ) // da apple way
@@ -240,9 +244,15 @@ void *
240244
241245 MULLE_C_UNUSED ( _cmd );
242246
247+ // TODO: check if these self checks arent super superflous in terms of
248+ // compiler emission )
243249 if ( ! self )
244250 return ( NULL );
245251
252+ // protection against wrap-around to root meta, which then clobbers
253+ // the runtime struct !
254+ assert ( _mulle_objc_class_is_infraclass ( _mulle_objc_object_get_isa ( self )));
255+
246256 p_ivar = (void * * ) & ((char * ) self )[ offset ];
247257 if ( strategy & mulle_objc_property_accessor_atomic )
248258 {
@@ -271,6 +281,15 @@ static inline void mulle_objc_object_add_to_container( void *self,
271281{
272282 void * * p_ivar ;
273283
284+ // TODO: check if these self checks arent super superflous in terms of
285+ // compiler emission )
286+ if ( ! self )
287+ return ;
288+
289+ // protection against wrap-around to root meta, which then clobbers
290+ // the runtime struct !
291+ assert ( _mulle_objc_class_is_infraclass ( _mulle_objc_object_get_isa ( self )));
292+
274293 p_ivar = (void * * ) & ((char * ) self )[ offset ];
275294
276295 assert_same_mulle_allocator ( self , value );
@@ -284,6 +303,15 @@ static inline void mulle_objc_object_remove_from_container( void *self,
284303{
285304 void * * p_ivar ;
286305
306+ // TODO: check if these self checks arent super superflous in terms of
307+ // compiler emission )
308+ if ( ! self )
309+ return ;
310+
311+ // protection against wrap-around to root meta, which then clobbers
312+ // the runtime struct !
313+ assert ( _mulle_objc_class_is_infraclass ( _mulle_objc_object_get_isa ( self )));
314+
287315 p_ivar = (void * * ) & ((char * ) self )[ offset ];
288316 mulle_objc_object_call_removeobject ( * p_ivar , value );
289317}
@@ -300,6 +328,15 @@ static inline void mulle_objc_object_will_read_relationship( void *self,
300328{
301329 void * * p_ivar ;
302330
331+ // TODO: check if these self checks arent super superflous in terms of
332+ // compiler emission )
333+ if ( ! self )
334+ return ;
335+
336+ // protection against wrap-around to root meta, which then clobbers
337+ // the runtime struct !
338+ assert ( _mulle_objc_class_is_infraclass ( _mulle_objc_object_get_isa ( self )));
339+
303340 p_ivar = (void * * ) & ((char * ) self )[ offset ];
304341 * p_ivar = mulle_objc_object_call_willreadrelationship ( self , * p_ivar );
305342}
0 commit comments