@@ -229,10 +229,10 @@ threads_table_mark_keyvalue(st_data_t key, st_data_t value, st_data_t tbl)
229229 }
230230 rb_gc_mark ((VALUE )value );
231231 if (is_living_thread (thread )) {
232- rb_gc_mark (thread );
232+ rb_gc_mark (thread );
233233 }
234234 else {
235- st_insert ((st_table * )tbl , key , 0 );
235+ st_insert ((st_table * )tbl , key , 0 );
236236 }
237237 return ST_CONTINUE ;
238238}
@@ -431,7 +431,7 @@ thread_context_lookup(VALUE thread, VALUE *context, debug_context_t **debug_cont
431431 }
432432 thread_id = ref2id (thread );
433433 Data_Get_Struct (rdebug_threads_tbl , threads_table_t , threads_table );
434- if (!st_lookup (threads_table -> tbl , thread_id , context ))
434+ if (!st_lookup (threads_table -> tbl , thread_id , context ) || ! * context )
435435 {
436436 if (create )
437437 {
@@ -1213,10 +1213,14 @@ debug_stop(VALUE self)
12131213}
12141214
12151215static int
1216- find_last_context_func (VALUE key , VALUE value , VALUE * result )
1216+ find_last_context_func (st_data_t key , st_data_t value , st_data_t result_arg )
12171217{
12181218 debug_context_t * debug_context ;
1219- Data_Get_Struct (value , debug_context_t , debug_context );
1219+ VALUE * result = (VALUE * )result_arg ;
1220+ if (!value ) {
1221+ return ST_CONTINUE ;
1222+ }
1223+ Data_Get_Struct ((VALUE )value , debug_context_t , debug_context );
12201224 if (debug_context -> thnum == last_debugged_thnum )
12211225 {
12221226 * result = value ;
0 commit comments