Browse Source

Z991239-1954 #comment fix: 增加临时对象释放逻辑

陈礼鹏80274480 4 years ago
parent
commit
1c45e6e412
1 changed files with 36 additions and 10 deletions
  1. 36 10
      Module/mod_interactivecontrol/mod_interactivecontrol.cpp

+ 36 - 10
Module/mod_interactivecontrol/mod_interactivecontrol.cpp

@@ -1060,7 +1060,10 @@ public:
 			Req.WndWidth = nWndWidth;
 			Req.WndHeight = nWndHeight;
 			CSmartPointer<IAsynWaitSp> spAsyncWait;
-			return pLocalPlayerClient->StartPlayVideo(Req, spAsyncWait, dwTimeout);
+			ErrorCodeEnum error = pLocalPlayerClient->StartPlayVideo(Req, spAsyncWait, dwTimeout);
+			pLocalPlayerClient->SafeDelete();
+			pLocalPlayerClient = NULL;
+			return error;
 		}
 	}
 
@@ -1076,7 +1079,10 @@ public:
 			PlayService_StartPlayAudio_Req Req;
 			Req.AudioNames = AudioNames;
 			CSmartPointer<IAsynWaitSp> spAsyncWait;
-			return pLocalPlayerClient->StartPlayAudio(Req, spAsyncWait, dwTimeout);
+			ErrorCodeEnum error = pLocalPlayerClient->StartPlayAudio(Req, spAsyncWait, dwTimeout);
+			pLocalPlayerClient->SafeDelete();
+			pLocalPlayerClient = NULL;
+			return error;
 		}
 	}
 
@@ -1096,7 +1102,10 @@ public:
 			Req.WndWidth = nWndWidth;
 			Req.WndHeight = nWndHeight;
 			CSmartPointer<IAsynWaitSp> spAsyncWait;
-			return pLocalPlayerClient->StartPlayImage(Req, spAsyncWait, dwTimeout);
+			ErrorCodeEnum error = pLocalPlayerClient->StartPlayImage(Req, spAsyncWait, dwTimeout);
+			pLocalPlayerClient->SafeDelete();
+			pLocalPlayerClient = NULL;
+			return error;
 		}
 	}
 
@@ -1112,7 +1121,10 @@ public:
 			PlayService_StopPlayVideo_Req Req;
 			Req.CfgInx = nCfgInx;
 			CSmartPointer<IAsynWaitSp> spAsyncWait;
-			return pLocalPlayerClient->StopPlayVideo(Req, spAsyncWait, dwTimeout);
+			ErrorCodeEnum error = pLocalPlayerClient->StopPlayVideo(Req, spAsyncWait, dwTimeout);
+			pLocalPlayerClient->SafeDelete();
+			pLocalPlayerClient = NULL;
+			return error;
 		}
 	}
 
@@ -1127,7 +1139,10 @@ public:
 		else {
 			PlayService_StopPlayAudio_Req Req;
 			CSmartPointer<IAsynWaitSp> spAsyncWait;
-			return pLocalPlayerClient->StopPlayAudio(Req, spAsyncWait, dwTimeout);
+			ErrorCodeEnum error = pLocalPlayerClient->StopPlayAudio(Req, spAsyncWait, dwTimeout);
+			pLocalPlayerClient->SafeDelete();
+			pLocalPlayerClient = NULL;
+			return error;
 		}
 	}
 
@@ -1143,7 +1158,10 @@ public:
 			PlayService_StopPlayImage_Req Req;
 			Req.CfgInx = nCfgInx;
 			CSmartPointer<IAsynWaitSp> spAsyncWait;
-			return pLocalPlayerClient->StopPlayImage(Req, spAsyncWait, dwTimeout);
+			ErrorCodeEnum error = pLocalPlayerClient->StopPlayImage(Req, spAsyncWait, dwTimeout);
+			pLocalPlayerClient->SafeDelete();
+			pLocalPlayerClient = NULL;
+			return error;
 		}
 	}
 
@@ -1162,6 +1180,8 @@ public:
 			//return m_pPlayClient->GetLocalVideoVolume(Req, spAsyncWait, dwTimeout);
 			PlayService_GetLocalVideoVolume_Ans Ans;
 			ErrorCodeEnum rtn = pLocalPlayerClient->GetLocalVideoVolume(Req, Ans, dwTimeout);
+			pLocalPlayerClient->SafeDelete();
+			pLocalPlayerClient = NULL;
 			nVolume = Ans.Volume;
 			return rtn;
 		}
@@ -1179,6 +1199,8 @@ public:
 			PlayService_GetLocalAudioVolume_Req Req;
 			PlayService_GetLocalAudioVolume_Ans Ans;
 			ErrorCodeEnum rtn = pLocalPlayerClient->GetLocalAudioVolume(Req, Ans, dwTimeout);
+			pLocalPlayerClient->SafeDelete();
+			pLocalPlayerClient = NULL;
 			nVolume = Ans.Volume;
 			return rtn;
 		}
@@ -1196,10 +1218,11 @@ public:
 			PlayService_SetLocalVideoVolume_Req Req;
 			Req.CfgInx = nCfgInx;
 			Req.Volume = nVolume;
-			//CSmartPointer<IAsynWaitSp> spAsyncWait;
-			//return m_pPlayClient->SetLocalVideoVolume(Req, spAsyncWait, dwTimeout);
 			PlayService_SetLocalVideoVolume_Ans Ans;
-			return pLocalPlayerClient->SetLocalVideoVolume(Req, Ans, dwTimeout);
+			ErrorCodeEnum error = pLocalPlayerClient->SetLocalVideoVolume(Req, Ans, dwTimeout);
+			pLocalPlayerClient->SafeDelete();
+			pLocalPlayerClient = NULL;
+			return error;
 		}
 	}
 
@@ -1215,7 +1238,10 @@ public:
 			PlayService_SetLocalAudioVolume_Req Req;
 			Req.Volume = nVolume;
 			PlayService_SetLocalAudioVolume_Ans Ans;
-			return pLocalPlayerClient->SetLocalAudioVolume(Req, Ans, dwTimeout);
+			ErrorCodeEnum error = pLocalPlayerClient->SetLocalAudioVolume(Req, Ans, dwTimeout);
+			pLocalPlayerClient->SafeDelete();
+			pLocalPlayerClient = NULL;
+			return error;
 		}
 	}