Commit graph

17,216 commits

Author SHA1 Message Date
William S Fulton
f81042057b Add changes note for #208 - array_functions initialisation 2014-09-27 16:55:46 +01:00
William S Fulton
54118d1d61 Merge branch 'tsuna-master'
* tsuna-master:
  Initialize C++ arrays created by array_functions' new_foo().
2014-09-27 16:51:47 +01:00
William S Fulton
a9ff9ab2b9 Add changes note for #187 - Ruby data sharing fix 2014-09-27 15:14:14 +01:00
William S Fulton
1fea434400 Merge branch 'lefticus-ruby_macos_static_data_conflicts'
* lefticus-ruby_macos_static_data_conflicts:
  Fix shared data problem on MacOS 10.9 with xcode 5.1
2014-09-27 15:12:04 +01:00
William S Fulton
d03ff2b262 Changes note for #168 - JNI leak fix 2014-09-27 14:48:13 +01:00
William S Fulton
0d34a0f0bf Merge branch 'pingany-director_local_jstring_leak'
* pingany-director_local_jstring_leak:
  Use more conventional naming for generated Java LocalRefGuard variables
  Make more use of LocalRefGuard in Java
  fixup! Patch of http://sourceforge.net/p/swig/mailman/message/29816385
  Patch of http://sourceforge.net/p/swig/mailman/message/29816385
2014-09-27 14:33:31 +01:00
William S Fulton
f4964f5fb3 Use more conventional naming for generated Java LocalRefGuard variables 2014-09-27 14:32:03 +01:00
William S Fulton
2f5bf397ae Make more use of LocalRefGuard in Java 2014-09-27 13:56:11 +01:00
Ian Lance Taylor
4b64ce71a3 [Go] Adjust generated code to work with upcoming Go 1.4 release. 2014-09-25 12:10:11 -07:00
Thomas Maslach
de6b433cb1 Fix Python crash when using -threads iterating containers
Also fixes li_std_vector_enum testcase when run with -threads.

Patch supplied on swig-devel mailing list on 12 Sep with details...

==============================================
I just wanted to mention that I found a crash issue in bug..

I am using SWIG 2.0.11 with python and have –threads enabled.  I have a C++ std::vector that I instantiate in SWIG with %template.  I also have a method in a class that returns this vector.  I also include std_vector.i, btw..

When I iterate like so:

children = Action.getActionList()
for child in children:
  pass

Everything is fine..

When I iterate like this:

for child in Action.getActionList()
  pass

Product crashes.

The problem is the following.  This code gets called first:

SWIGINTERN PyObject *_wrap_delete_SwigPyIterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;

  if(!PyArg_UnpackTuple(args,(char *)"delete_SwigPyIterator",1,1,&obj0)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SwigPyIterator" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    delete arg1;
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}

Note the SWIG_PYTHON_THREAD_BEGIN_ALLOW/END_ALLOW. In between those two statements, we delete arg1.  That in turn will eventually end up in this code:

namespace swig {
  class SwigPtr_PyObject {
  protected:
    PyObject *_obj;

  public:
    … snip! …
    ~SwigPtr_PyObject()
    {
      Py_XDECREF(_obj);
    }

Uh-oh!  We call Py_XDECREF when we aren’t supposed to because we are in a SWIG_PYTHON_THREAD_BEGIN_ALLOW/END_ALLOW section!

This takes care of the issue:

namespace swig {
  class SwigPtr_PyObject {
  protected:
    PyObject *_obj;

  public:
    … snip! …
    ~SwigPtr_PyObject()
    {
      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
      Py_XDECREF(_obj);
      SWIG_PYTHON_THREAD_END_BLOCK;
    }

There are several other methods in this class that use the Python API, but don’t have the BEGIN/END block defined.  I’m not sure if they are required for all of them, but I believe they are..

I have attached a modified pyclasses.swg with what I believe are the correct changes.  This code is from 2.0.11, but as far as I can tell, it’s the same as what is in 3.0.2…

Apologies for not doing more here (making/running tests, getting it in the code repository, etc..), but I’m under some pressure to get some unrelated things done…
2014-09-23 22:33:25 +01:00
William S Fulton
783e816d89 Testcase warning suppression 2014-09-23 19:54:13 +01:00
William S Fulton
15152596f2 Change file for #228 and #229 2014-09-17 22:19:07 +01:00
Richard Pastrick
11d07bb45b add bool array type to arrays_csharp.i [issue #228] 2014-09-17 22:17:36 +01:00
William S Fulton
fea2fc137e Suppress Octave failing the build
li_std_vector testcase causing g++ internal compiler error
2014-09-16 19:19:48 +01:00
William S Fulton
8128b1e12f For Android examples, replace hard coded tool names with those detected at configure time. 2014-09-15 19:44:18 +01:00
Ian Lance Taylor
39433f12e4 Fix one case where we test goout rather than has_goout. The effect
was to incorrect use a return statement before the goout typemap
code.
2014-09-12 17:46:21 -07:00
Olly Betts
1a99212c2c [PHP] Add support for specifying any PHP interfaces a wrapped class
implements, e.g.: %typemap("phpinterfaces") MyIterator "Iterator";
2014-09-12 12:48:37 -03:00
Olly Betts
e12322df86 [PHP] Fix throwing a PHP exception through C++ from a subclassed
director method - PHP NULL gets returned by the subclassed method
in this case, so the directorout typemap needs to allow that (at
least if an exception is active).
2014-09-11 13:09:08 -03:00
Olly Betts
fa94a29df4 Fix comment typo 2014-09-11 13:06:17 -03:00
Ian Lance Taylor
06b1157470 Make sure to give all parameters a local before adding all the new
typemaps.

Also mark C functions compiled by 6c and friends as nosplit.
2014-09-10 16:17:54 -07:00
Ian Lance Taylor
acaaa0f31f [Go] Add goargout typemap. 2014-09-09 11:28:04 -07:00
Olly Betts
0dd7b61c57 Fix segmentation faults with directors in PHP >= 5.4 2014-09-09 13:39:30 -03:00
Ian Lance Taylor
be145043df Add run test case for argout.i. 2014-09-07 15:44:12 -07:00
Ian Lance Taylor
1addbb46a8 [Go] Add imtype, goin, goout, godirectorin, and godirectorout
typemaps, to support writing Go code to convert between types.
2014-09-05 17:54:19 -07:00
Olly Betts
6eaec9ce7c Update expected output for pp_constant error test 2014-09-04 09:29:20 -03:00
Olly Betts
b9fe7b5f00 Disable case in pp_constant.i which never actually worked 2014-09-03 17:18:11 -03:00
Olly Betts
d3b3ff2c78 Fix comment typo 2014-09-02 23:12:35 -03:00
Olly Betts
926fd75878 Additional fixes for #218. 2014-09-02 23:12:09 -03:00
Olly Betts
f3a6c55929 [Python] Fix regression in indentation of python code produced with -modern,
introduced by changes in #188.  Reported by fabiencastan in #218.
2014-09-02 02:34:01 -03:00
Olly Betts
255c929c56 Issue an error for unknown SWIG preprocessor directives, rather
than quietly ignoring them.  Reported by jrhelsey in issue#217.
2014-09-01 00:26:15 -03:00
Olly Betts
14c2cf3407 PHP: Fix memory leak if a director method is passed Null for self 2014-08-29 16:28:00 -03:00
Ian Lance Taylor
e6882287af Add generated Go files to .gitignore. 2014-08-25 15:58:10 -07:00
Olly Betts
dca73b1677 Merge pull request #209 from talby-/inc_guard
apply SF Patch #350 and add testcase
2014-08-17 11:53:01 +12:00
Robert Stone
488aed4224 apply SF Patch #350 and add testcase 2014-08-15 21:47:10 -07:00
William S Fulton
54218bfe3f C# exception %exception example fix
From Cindy Gan
[skip ci]
2014-08-15 19:06:02 +01:00
Pingan Yi
f38f6371a3 fixup! Patch of http://sourceforge.net/p/swig/mailman/message/29816385 2014-08-13 16:14:57 +08:00
Benoit Sigoure
16549a36e3 Initialize C++ arrays created by array_functions' new_foo().
`array_functions(TYPE, NAME)' generates a `new_foo(size)' function that
allocates a new array of the given type.  When compiling in C, the array
is initialized with `calloc()', which shows that the intent was to have
the array be zero-initialized.  When in C++, however, the array was not
getting initialized, so it could contain random garbage after creation,
when the type was a POD type.

This change makes `new_foo(size)' create a value-initialized array when
in C++, as per the C++ standard's 5.3.4.15 that says that adding a pair
of parentheses at the end of a new-expression does that.
2014-08-12 23:44:50 -07:00
Kris Thielemans
f6b10f299f small suggestions for changes in std_ios.i
Hi

Would it be possible to add the following 2 typedefs to std_ios.i?

 typedef basic_ios<char> ios;
 typedef basic_ios<wchar_t> wios;

at present, it contains only

 %template(ios) basic_ios<char>;
 %template(wios) basic_ios<wchar_t>;

This means however that things like std::ios::openmode are currently not
recognised by SWIG. With the above typedefs, they are. Similar typedefs
should probably be added in std_iostream.i for ostream etc.

Also, while checking std_ios.i, it seems that the definition of basic_ios
has a copy-paste error in the private section (the constructor is still as
ios_base). To avoid confusion, I suggest to change that. Below is a diff
with the suggested changes.

Kris
2014-08-12 23:45:02 +01:00
Olly Betts
c43f84af02 Improve PHP docs about extension= and dl() 2014-08-12 14:45:54 +12:00
Olly Betts
227dd35609 Fix incorrect examples of regex %rename 2014-08-12 14:33:25 +12:00
Olly Betts
6eb6f72e1b Merge pull request #204 from ibell/patch-1
Update Php.html
2014-08-12 14:31:12 +12:00
Ian Bell
b8d3ff060a Update Php.html
Short summary of the fact that dl() function can no longer be used.
2014-08-11 20:46:49 +02:00
William S Fulton
e2b4a72f3e Tcl documentation correction
From Ben Golding on swig-devel list.
2014-08-11 19:12:05 +01:00
William S Fulton
2b71c99feb Add C# license header changes for StyleCop to changes file 2014-08-04 19:44:47 +01:00
William S Fulton
e5b98d8331 Merge branch 'gpetrou-CSharpLicense' - Add autogenerated xml for StyleCop.
* gpetrou-CSharpLicense:
  Tweak generated C# .cs files header
  Changed CSharp license header to include auto-generated tag so that StyleCop ignores the files.
2014-08-04 19:42:16 +01:00
William S Fulton
69736cc0cb Tweak generated C# .cs files header 2014-08-04 19:41:38 +01:00
William S Fulton
d180908066 Merge branch 'yuvalk-master' - Java NIOBUFFER typemaps for java.nio.ByteBuffer
* yuvalk-master:
  Add changes entry for NIOBUFFER Java typemaps
  Doc/comment improvements in Java various.i
  Add support for java.nio.Buffer including test-suite test case and documentation
2014-08-04 19:31:28 +01:00
William S Fulton
db7514860d Add changes entry for NIOBUFFER Java typemaps 2014-08-04 19:27:30 +01:00
William S Fulton
1773726073 Doc/comment improvements in Java various.i 2014-08-04 19:22:02 +01:00
gpetrou
8433539849 Changed CSharp license header to include auto-generated tag so that StyleCop ignores the files. 2014-08-02 08:35:15 +01:00