Ignore:
Timestamp:
Feb 16, 2018 9:37:00 AM (6 years ago)
Author:
nanang
Message:

Misc (#2059): Update Android & Java app samples to avoid call instance deletion in the library callback context (thanks Kai Ludwig for the feedbacks).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/swig/java/android/app/src/main/java/org/pjsip/pjsua2/app/MyApp.java

    r5649 r5738  
    6262    public void onCallState(OnCallStateParam prm) 
    6363    { 
    64             MyApp.observer.notifyCallState(this); 
    65             try { 
    66                 CallInfo ci = getInfo(); 
    67                 if (ci.getState() ==  
    68                     pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED) 
    69                 { 
    70                     MyApp.ep.utilLogWrite(3, "MyCall", this.dump(true, "")); 
    71                     this.delete(); 
    72                 } 
    73             } catch (Exception e) { 
    74                 return; 
    75             } 
     64        try { 
     65            CallInfo ci = getInfo(); 
     66            if (ci.getState() ==  
     67                pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED) 
     68            { 
     69                MyApp.ep.utilLogWrite(3, "MyCall", this.dump(true, "")); 
     70            } 
     71        } catch (Exception e) { 
     72        } 
     73         
     74        // Should not delete this call instance (self) in this context, 
     75        // so the observer should manage this call instance deletion 
     76        // out of this callback context. 
     77        MyApp.observer.notifyCallState(this); 
    7678    } 
    7779 
Note: See TracChangeset for help on using the changeset viewer.