Re #2086: Add more info for better understanding of the lifetime of PJSUA2 objects. And add an example to explicitly delete PJSUA2 objects.

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@5736 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Sauw Ming 2018-02-12 07:07:02 +00:00
parent 08ff24ac94
commit 8f28537db2
1 changed files with 8 additions and 0 deletions

View File

@ -24,6 +24,11 @@ namespace pjsua2xamarin
{
public class MyAccount : Account
{
~MyAccount()
{
Console.WriteLine("*** Account is being deleted");
}
override public void onRegState(OnRegStateParam prm)
{
AccountInfo ai = getInfo();
@ -80,6 +85,9 @@ namespace pjsua2xamarin
MyAccount acc = new MyAccount();
acc.create(accCfg);
Console.WriteLine("*** DESTROYING PJSUA2 ***");
// Explicitly delete account when unused
acc.Dispose();
ep.libDestroy();
} catch (Exception err) {
Console.WriteLine("Exception: " + err.Message);