summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2014-08-26 07:27:23 +0000
committerNanang Izzuddin <nanang@teluu.com>2014-08-26 07:27:23 +0000
commit0dac244647ef979381d05bb2781c564717519f10 (patch)
tree4f1a018ca95732a268c7cef9b37ecc87cbe85ca8
parent9df42d2e02f33db21f4a92af48be24922ab268a9 (diff)
Re #1768: Add forced GC to libDestroy() in SWIG Java.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4906 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip-apps/src/swig/pjsua2.i22
1 files changed, 21 insertions, 1 deletions
diff --git a/pjsip-apps/src/swig/pjsua2.i b/pjsip-apps/src/swig/pjsua2.i
index aff740b4..ae76bd51 100644
--- a/pjsip-apps/src/swig/pjsua2.i
+++ b/pjsip-apps/src/swig/pjsua2.i
@@ -102,7 +102,6 @@ using namespace pj;
%template(CodecInfoVector) std::vector<pj::CodecInfo*>;
%include "pjsua2/media.hpp"
-%include "pjsua2/endpoint.hpp"
%include "pjsua2/presence.hpp"
%include "pjsua2/account.hpp"
%include "pjsua2/call.hpp"
@@ -112,3 +111,24 @@ using namespace pj;
%ignore pj::JsonDocument::allocElement;
%ignore pj::JsonDocument::getPool;
%include "pjsua2/json.hpp"
+
+// Try force Java GC before destroying the lib:
+// - to avoid late destroy of PJ objects by GC
+// - to avoid destruction of PJ objects from a non-registered GC thread
+#ifdef SWIGJAVA
+%rename(libDestroy_) pj::Endpoint::libDestroy;
+%typemap(javacode) pj::Endpoint %{
+ public void libDestroy(long prmFlags) throws java.lang.Exception {
+ Runtime.getRuntime().gc();
+ libDestroy_(prmFlags);
+ }
+
+ public void libDestroy() throws java.lang.Exception {
+ Runtime.getRuntime().gc();
+ libDestroy_();
+ }
+%}
+#endif
+
+%include "pjsua2/endpoint.hpp"
+