瀏覽代碼

Fixed conditional.

woollybah 5 年之前
父節點
當前提交
47c6602c7f
共有 1 個文件被更改,包括 7 次插入6 次删除
  1. 7 6
      blitz.mod/blitz_gc.c

+ 7 - 6
blitz.mod/blitz_gc.c

@@ -107,14 +107,15 @@ BBObject * bbGCAllocObject( int sz,BBClass *clas,int flags ){
 	++bbGCAllocCount;
 	++bbGCAllocCount;
 	#endif
 	#endif
 	q->clas=clas;
 	q->clas=clas;
+	
 	if (bbCountInstances) {
 	if (bbCountInstances) {
 		bbAtomicAdd(&clas->instance_count, 1);
 		bbAtomicAdd(&clas->instance_count, 1);
-	} else {
-		if( flags & BBGC_FINALIZE ){
-			GC_finalization_proc ofn;
-			void *ocd;
-			GC_REGISTER_FINALIZER_NO_ORDER( q,gc_finalizer,clas,&ofn,&ocd );
-		}
+	}
+	
+	if( (flags & BBGC_FINALIZE) || bbCountInstances ){
+		GC_finalization_proc ofn;
+		void *ocd;
+		GC_REGISTER_FINALIZER_NO_ORDER( q,gc_finalizer,clas,&ofn,&ocd );
 	}
 	}
 	return q;	
 	return q;	
 }
 }