Cosmetic tidyup in smartptr feature code and document smartptr fix in previous commit
This commit is contained in:
parent
25eaee49f3
commit
296498c159
3 changed files with 11 additions and 12 deletions
|
|
@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release.
|
|||
Version 2.0.10 (in progress)
|
||||
============================
|
||||
|
||||
2013-04-17: wsfulton
|
||||
[C#] Pull patch #34 from BrantKyser to fix smart pointers in conjuction with directors.
|
||||
|
||||
2013-04-08: kwwette
|
||||
Add -MP option to SWIG for generating phony targets for all dependencies.
|
||||
- Prevents make from complaining if header files have been deleted before
|
||||
|
|
|
|||
|
|
@ -3382,7 +3382,7 @@ public:
|
|||
String *qualified_classname = Copy(sym_name);
|
||||
String *nspace = getNSpace();
|
||||
String *dirClassName = directorClassName(n);
|
||||
String *smartptr_feature = Getattr(n, "feature:smartptr");
|
||||
String *smartptr = Getattr(n, "feature:smartptr");
|
||||
|
||||
if (nspace)
|
||||
Insert(qualified_classname, 0, NewStringf("%s.", nspace));
|
||||
|
|
@ -3393,8 +3393,8 @@ public:
|
|||
Wrapper *code_wrap = NewWrapper();
|
||||
Printf(code_wrap->def, "SWIGEXPORT void SWIGSTDCALL %s(void *objarg", wname);
|
||||
|
||||
if (Len(smartptr_feature)) {
|
||||
Printf(code_wrap->code, " %s *obj = (%s *)objarg;\n", smartptr_feature, smartptr_feature);
|
||||
if (Len(smartptr)) {
|
||||
Printf(code_wrap->code, " %s *obj = (%s *)objarg;\n", smartptr, smartptr);
|
||||
Printf(code_wrap->code, " // Keep a local instance of the smart pointer around while we are using the raw pointer\n");
|
||||
Printf(code_wrap->code, " // Avoids using smart pointer specific API.\n");
|
||||
Printf(code_wrap->code, " %s *director = dynamic_cast<%s *>(obj->operator->());\n", dirClassName, dirClassName);
|
||||
|
|
|
|||
|
|
@ -3389,7 +3389,7 @@ public:
|
|||
String *norm_name = SwigType_namestr(Getattr(n, "name"));
|
||||
String *swig_director_connect = Swig_name_member(getNSpace(), proxy_class_name, "director_connect");
|
||||
String *swig_director_connect_jni = makeValidJniName(swig_director_connect);
|
||||
String *smartptr_feature = Getattr(n, "feature:smartptr");
|
||||
String *smartptr = Getattr(n, "feature:smartptr");
|
||||
String *dirClassName = directorClassName(n);
|
||||
Wrapper *code_wrap;
|
||||
|
||||
|
|
@ -3401,15 +3401,11 @@ public:
|
|||
"SWIGEXPORT void JNICALL Java_%s%s_%s(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, "
|
||||
"jboolean jweak_global) {\n", jnipackage, jni_imclass_name, swig_director_connect_jni);
|
||||
|
||||
if (Len(smartptr_feature)) {
|
||||
Printf(code_wrap->code, " %s *obj = *((%s **)&objarg);\n", smartptr_feature, smartptr_feature);
|
||||
if (Len(smartptr)) {
|
||||
Printf(code_wrap->code, " %s *obj = *((%s **)&objarg);\n", smartptr, smartptr);
|
||||
Printf(code_wrap->code, " (void)jcls;\n");
|
||||
Printf(code_wrap->code, " // NOTE: Pulling the raw pointer out of the smart pointer as the following code does\n");
|
||||
Printf(code_wrap->code, " // is generally a bad idea. However, in this case we keep a local instance of the\n");
|
||||
Printf(code_wrap->code, " // smart pointer around while we are using the raw pointer, which should keep the\n");
|
||||
Printf(code_wrap->code, " // raw pointer alive. This is done instead of using the smart pointer's dynamic cast\n");
|
||||
Printf(code_wrap->code, " // feature since different smart pointer implementations have differently named dynamic\n");
|
||||
Printf(code_wrap->code, " // cast mechanisms.\n");
|
||||
Printf(code_wrap->code, " // Keep a local instance of the smart pointer around while we are using the raw pointer\n");
|
||||
Printf(code_wrap->code, " // Avoids using smart pointer specific API.\n");
|
||||
Printf(code_wrap->code, " %s *director = dynamic_cast<%s *>(obj->operator->());\n", dirClassName, dirClassName);
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue