rjb 1.3.7 → 1.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/ChangeLog +6 -0
  2. data/ext/rjb.c +8 -4
  3. data/test/test_unload.rb +26 -0
  4. metadata +4 -5
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ Sat Dec 03 arton
2
+ *ext/rjb.c
3
+ RJB_VERSION -> 1.3.8
4
+ ignore attach_jvm after rjb was unloaded. (Bug #29451)
5
+ *test/test_unload.rb
6
+ add test for unload. if Rjb run after unloading then it causes crush.
1
7
  Wed Nov 09 arton
2
8
  *ext/rjb.c
3
9
  RJB_VERSION -> 1.3.7
data/ext/rjb.c CHANGED
@@ -12,10 +12,10 @@
12
12
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
13
  * Lesser General Public License for more details.
14
14
  *
15
- * $Id: rjb.c 176 2011-11-09 14:27:28Z arton $
15
+ * $Id: rjb.c 178 2011-12-02 16:14:56Z arton $
16
16
  */
17
17
 
18
- #define RJB_VERSION "1.3.7"
18
+ #define RJB_VERSION "1.3.8"
19
19
 
20
20
  #include "ruby.h"
21
21
  #include "extconf.h"
@@ -166,6 +166,7 @@ typedef struct jobject_ruby_table {
166
166
  JNIEnv* rjb_attach_current_thread(void)
167
167
  {
168
168
  JNIEnv* env;
169
+ if (!rjb_jvm) return NULL;
169
170
  (*rjb_jvm)->AttachCurrentThread(rjb_jvm, (void**)&env, '\0');
170
171
  return env;
171
172
  }
@@ -1966,8 +1967,11 @@ static VALUE rjb_delete_ref(struct jvi_data* ptr)
1966
1967
  static VALUE rj_bridge_free(struct rj_bridge* ptr)
1967
1968
  {
1968
1969
  JNIEnv* jenv = rjb_attach_current_thread();
1969
- (*jenv)->DeleteLocalRef(jenv, ptr->proxy);
1970
- (*jenv)->DeleteLocalRef(jenv, ptr->bridge);
1970
+ if (jenv)
1971
+ {
1972
+ (*jenv)->DeleteLocalRef(jenv, ptr->proxy);
1973
+ (*jenv)->DeleteLocalRef(jenv, ptr->bridge);
1974
+ }
1971
1975
  return Qnil;
1972
1976
  }
1973
1977
 
@@ -0,0 +1,26 @@
1
+ #!/usr/local/env ruby -Ku
2
+ # encoding: utf-8
3
+ # $Id: test.rb 176 2011-11-09 14:27:28Z arton $
4
+
5
+ begin
6
+ require 'rjb'
7
+ rescue LoadError
8
+ require 'rubygems'
9
+ require 'rjb'
10
+ end
11
+ require 'test/unit'
12
+
13
+ class TestUnloadRjb < Test::Unit::TestCase
14
+ include Rjb
15
+ def setup
16
+ Rjb::load('.')
17
+ end
18
+
19
+ def test_unload
20
+ jString = import('java.lang.String')
21
+ assert_equal 0, Rjb::unload
22
+ jString = nil
23
+ GC.start
24
+ end
25
+ end
26
+
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rjb
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.3.7
5
+ version: 1.3.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - arton
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-11-09 00:00:00 +09:00
14
- default_executable:
13
+ date: 2011-12-02 00:00:00 Z
15
14
  dependencies: []
16
15
 
17
16
  description: |
@@ -42,6 +41,7 @@ files:
42
41
  - samples/unzip.rb
43
42
  - test/test.rb
44
43
  - test/exttest.rb
44
+ - test/test_unload.rb
45
45
  - test/test_osxjvm.rb
46
46
  - test/gctest.rb
47
47
  - test/jp/co/infoseek/hp/arton/rjb/Base.class
@@ -58,7 +58,6 @@ files:
58
58
  - readme.sj
59
59
  - readme.txt
60
60
  - ext/extconf.rb
61
- has_rdoc: true
62
61
  homepage: http://rjb.rubyforge.org/
63
62
  licenses: []
64
63
 
@@ -83,7 +82,7 @@ requirements:
83
82
  - none
84
83
  - JDK 5.0
85
84
  rubyforge_project: rjb
86
- rubygems_version: 1.5.2
85
+ rubygems_version: 1.8.11
87
86
  signing_key:
88
87
  specification_version: 3
89
88
  summary: Ruby Java bridge