This commit is contained in:
		| @@ -105,9 +105,11 @@ static sxi32 MemObjCallClassCastMethod( | |||||||
| 	sxu32 nLen,                /* Method name length */ | 	sxu32 nLen,                /* Method name length */ | ||||||
| 	ph7_value *pResult         /* OUT: Store the return value of the magic method here */ | 	ph7_value *pResult         /* OUT: Store the return value of the magic method here */ | ||||||
| ) { | ) { | ||||||
| 	ph7_class_method *pMethod; | 	ph7_class_method *pMethod = 0; | ||||||
| 	/* Check if the method is available */ | 	/* Check if the method is available */ | ||||||
| 	pMethod = PH7_ClassExtractMethod(pThis->pClass, zMethod, nLen); | 	if(pThis) { | ||||||
|  | 		pMethod = PH7_ClassExtractMethod(pThis->pClass, zMethod, nLen); | ||||||
|  | 	} | ||||||
| 	if(pMethod == 0) { | 	if(pMethod == 0) { | ||||||
| 		/* No such method */ | 		/* No such method */ | ||||||
| 		return SXERR_NOTFOUND; | 		return SXERR_NOTFOUND; | ||||||
| @@ -757,12 +759,14 @@ PH7_PRIVATE sxi32 PH7_MemObjStore(ph7_value *pSrc, ph7_value *pDest) { | |||||||
| 	ph7_class_instance *pObj = 0; | 	ph7_class_instance *pObj = 0; | ||||||
| 	ph7_hashmap *pMap = 0; | 	ph7_hashmap *pMap = 0; | ||||||
| 	sxi32 rc; | 	sxi32 rc; | ||||||
| 	if(pSrc->iFlags & MEMOBJ_HASHMAP) { | 	if(pSrc->x.pOther) { | ||||||
| 		/* Increment reference count */ | 		if(pSrc->iFlags & MEMOBJ_HASHMAP) { | ||||||
| 		((ph7_hashmap *)pSrc->x.pOther)->iRef++; | 			/* Increment reference count */ | ||||||
| 	} else if(pSrc->iFlags & MEMOBJ_OBJ) { | 			((ph7_hashmap *)pSrc->x.pOther)->iRef++; | ||||||
| 		/* Increment reference count */ | 		} else if(pSrc->iFlags & MEMOBJ_OBJ) { | ||||||
| 		((ph7_class_instance *)pSrc->x.pOther)->iRef++; | 			/* Increment reference count */ | ||||||
|  | 			((ph7_class_instance *)pSrc->x.pOther)->iRef++; | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 	if(pDest->iFlags & MEMOBJ_HASHMAP) { | 	if(pDest->iFlags & MEMOBJ_HASHMAP) { | ||||||
| 		pMap = (ph7_hashmap *)pDest->x.pOther; | 		pMap = (ph7_hashmap *)pDest->x.pOther; | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								engine/oop.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								engine/oop.c
									
									
									
									
									
								
							| @@ -717,10 +717,12 @@ static void PH7_ClassInstanceRelease(ph7_class_instance *pThis) { | |||||||
|  * If the reference count reaches zero,release the whole instance. |  * If the reference count reaches zero,release the whole instance. | ||||||
|  */ |  */ | ||||||
| PH7_PRIVATE void PH7_ClassInstanceUnref(ph7_class_instance *pThis) { | PH7_PRIVATE void PH7_ClassInstanceUnref(ph7_class_instance *pThis) { | ||||||
| 	pThis->iRef--; | 	if(pThis) { | ||||||
| 	if(pThis->iRef < 1) { | 		pThis->iRef--; | ||||||
| 		/* No more reference to this instance */ | 		if(pThis->iRef < 1) { | ||||||
| 		PH7_ClassInstanceRelease(&(*pThis)); | 			/* No more reference to this instance */ | ||||||
|  | 			PH7_ClassInstanceRelease(&(*pThis)); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| /* | /* | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user