Changeset 498:5c4840391e7b in verona


Ignore:
Timestamp:
Jun 6, 2012 3:40:39 PM (12 months ago)
Author:
Vadim Lebedev <vadim@…>
Branch:
default
Message:

avoid memory leaks in java director calls

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • phcpp/phapipp.h

    r497 r498  
    7575        virtual ~phapi(); 
    7676 
     77#ifdef SWIG 
     78#define virtual 
     79#endif 
     80 
    7781        virtual int init(bool asyncMode = true); 
    7882        virtual void terminate(); 
     
    206210 
    207211protected: 
     212#ifdef SWIG 
     213#undef virtual 
     214#endif 
    208215 
    209216        //  user overridable callbacks 
  • swig/verona.i

    r497 r498  
    142142 
    143143%typemap(directorin,descriptor="Ljava/lang/String;") std::string  
    144 %{ $input = make_jstr(jenv, &$1); %} 
     144%{ 
     145   // dirin std::string 
     146   $input = make_jstr(jenv, &$1);  
     147   TmpJOBJ tmp$1_name(jenv, (jobject) $input); 
     148%} 
    145149 
    146150%typemap(out) std::string  
     
    148152 
    149153%typemap(directorin,descriptor="Ljava/lang/String;") const std::string & 
    150 %{ $input = make_jstr(jenv, &$1); %} 
     154%{  
     155   // dirin cost std::string& 
     156   $input = make_jstr(jenv, &$1);  
     157   TmpJOBJ tmp$1_name(jenv, (jobject) $input); 
     158%} 
     159 
     160%typemap(directorin,descriptor="Ljava/lang/String;") const char*, char*  
     161%{ 
     162   // dirin char* 
     163  $input = 0; 
     164  if ($1) { 
     165    $input = jenv->NewStringUTF((const char *)$1); 
     166    if (!$input) return $null; 
     167  } 
     168   
     169  TmpJOBJ tmp$1_name(jenv, (jobject) $input); 
     170%} 
     171 
    151172 
    152173%typemap(out) const std::string &  
     
    163184#else 
    164185%include "std_map.i" 
     186#ifndef SWIGJAVA 
    165187%include "std_string.i" 
     188#endif 
    166189%include "std_vector.i" 
    167190%include "std_pair.i" 
Note: See TracChangeset for help on using the changeset viewer.