[ruby-oci8-commit] [234] trunk/ruby-oci8: * ext/oci8/error.c: fix a SEGV bug when an error is raised in GC.
nobody at rubyforge.org
nobody at rubyforge.org
Thu Jan 3 10:10:51 EST 2008
Revision: 234
Author: kubo
Date: 2008-01-03 10:10:51 -0500 (Thu, 03 Jan 2008)
Log Message:
-----------
* ext/oci8/error.c: fix a SEGV bug when an error is raised in GC.
make a custom backtrace entry only when 'caller' returns an Array.
Modified Paths:
--------------
trunk/ruby-oci8/ChangeLog
trunk/ruby-oci8/ext/oci8/error.c
Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog 2007-12-29 13:38:23 UTC (rev 233)
+++ trunk/ruby-oci8/ChangeLog 2008-01-03 15:10:51 UTC (rev 234)
@@ -1,3 +1,7 @@
+2008-01-03 KUBO Takehiro <kubo at jiubao.org>
+ * ext/oci8/error.c: fix a SEGV bug when an error is raised in GC.
+ make a custom backtrace entry only when 'caller' returns an Array.
+
2007-12-29 KUBO Takehiro <kubo at jiubao.org>
* lib/oci8/metadata.rb, lib/oci8/oci8.rb: support cursors in a
result set. For example:
Modified: trunk/ruby-oci8/ext/oci8/error.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/error.c 2007-12-29 13:38:23 UTC (rev 233)
+++ trunk/ruby-oci8/ext/oci8/error.c 2008-01-03 15:10:51 UTC (rev 234)
@@ -156,10 +156,12 @@
file = p + 1;
#endif
backtrace = rb_funcall(rb_cObject, oci8_id_caller, 0);
- snprintf(errmsg, sizeof(errmsg), "%s:%d:in oci8lib.so", file, line);
- errmsg[sizeof(errmsg) - 1] = '\0';
- rb_ary_unshift(backtrace, rb_str_new2(errmsg));
- rb_funcall(exc, oci8_id_set_backtrace, 1, backtrace);
+ if (TYPE(backtrace) == T_ARRAY) {
+ snprintf(errmsg, sizeof(errmsg), "%s:%d:in oci8lib.so", file, line);
+ errmsg[sizeof(errmsg) - 1] = '\0';
+ rb_ary_unshift(backtrace, rb_str_new2(errmsg));
+ rb_funcall(exc, oci8_id_set_backtrace, 1, backtrace);
+ }
rb_exc_raise(exc);
}
More information about the ruby-oci8-commit
mailing list