Skip to content

Commit

Permalink
fix commit/rollback crash; add ref to type->actual_type
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed Nov 28, 2024
1 parent 8abd85d commit 4f0c490
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/core/chuck_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,12 +1111,10 @@ t_CKBOOL Chuck_Compiler::compile_single( Chuck_CompileTarget * target )

// commit
if( ret ) // 1.5.4.3 (ge) update to call commit_namespaces | was: env()->global()->commit();
{ env()->global()->commit(); }
// { env()->commit_namespaces(); }
{ env()->commit_namespaces(); }
// or rollback
else // 1.5.4.3 (ge) update to call commit_namespaces | was: env()->global()->rollback();
{ env()->global()->rollback(); }
// { env()->rollback_namespaces(); }
{ env()->rollback_namespaces(); }

// unload the context from the type-checker
if( !type_engine_unload_context( env() ) )
Expand Down
3 changes: 2 additions & 1 deletion src/core/chuck_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ t_CKBOOL type_engine_scan0_class_def( Chuck_Env * env, a_Class_Def class_def )

// allocate value
type = env->ckt_class->copy( env, env->context );
type->actual_type = the_class;
// 1.5.4.3 (ge) add reference count to actual_type | was: type->actual_type = the_class;
CK_SAFE_REF_ASSIGN(type->actual_type, the_class);
value = env->context->new_Chuck_Value( type, the_class->base_name );
value->owner = env->curr; CK_SAFE_ADD_REF(value->owner);
value->is_const = TRUE;
Expand Down
9 changes: 4 additions & 5 deletions src/core/chuck_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,12 +904,10 @@ t_CKBOOL type_engine_check_prog( Chuck_Env * env, a_Program prog,

// commit
if( ret ) // 1.5.4.3 (ge) update to env->commit_namespaces() | was: env->global()->commit();
{ env->global()->commit(); }
// { env->commit_namespaces(); }
{ env->commit_namespaces(); }
// or rollback
else // 1.5.4.3 (ge) update to env->commit_namespaces() | was: env->global()->rollback();
{ env->global()->rollback(); }
// { env->rollback_namespaces(); }
{ env->rollback_namespaces(); }

// unload the context from the type-checker
if( !type_engine_unload_context( env ) )
Expand Down Expand Up @@ -9936,7 +9934,8 @@ void Chuck_Type::reset()
// TODO: verify this is valid for final shutdown sequence, including Chuck_Env::cleanup()
CK_SAFE_RELEASE( ugen_info ); // 1.5.4.3 (ge) added #2024-func-call-update
CK_SAFE_RELEASE( func_bridge ); // 1.5.4.3 (ge) added #2024-func-call-update
CK_SAFE_RELEASE( array_type ); // 1.5.4.3 (ge) added #2024-func-call-update
// FYI actual_type is UNION with array_type
CK_SAFE_RELEASE( actual_type ); // 1.5.4.3 (ge) added #2024-func-call-update
CK_SAFE_RELEASE( parent_type ); // 1.5.4.3 (ge) added #2024-func-call-update
}
}
Expand Down

0 comments on commit 4f0c490

Please sign in to comment.