summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-07 01:58:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-07 01:58:09 +0000
commit9c8d9f31f70a73d041c8c1797a0d795d97ca4412 (patch)
tree413187a17dd065dfb79505c2fac2dc67e1c3b560
parentbf5d6f07231fca3756da765d3741c44bd3e1b969 (diff)
win32ole_event.c: use rb_write_error_str
* ext/win32ole/win32ole_event.c (rescue_callback): use rb_write_error_str instead of rb_write_error, to respect the encoding and prevent the message from GC. * internal.h (rb_write_error_str): export. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--ext/win32ole/win32ole_event.c4
-rw-r--r--internal.h2
3 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index fcd3766..0494527 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Mon Mar 7 10:58:07 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/win32ole/win32ole_event.c (rescue_callback): use
+ rb_write_error_str instead of rb_write_error, to respect
+ the encoding and prevent the message from GC.
+
+ * internal.h (rb_write_error_str): export.
+
Mon Mar 7 01:38:41 2016 Rei Odaira <Rei.Odaira@gmail.com>
* test/ruby/test_process.rb (test_execopts_gid): Skip a test
diff --git a/ext/win32ole/win32ole_event.c b/ext/win32ole/win32ole_event.c
index 8e30732..577333b 100644
--- a/ext/win32ole/win32ole_event.c
+++ b/ext/win32ole/win32ole_event.c
@@ -6,6 +6,8 @@
* <code>WIN32OLE_EVENT</code> objects controls OLE event.
*/
+RUBY_EXTERN void rb_write_error_str(VALUE mesg);
+
typedef struct {
struct IEventSinkVtbl * lpVtbl;
} IEventSink, *PEVENTSINK;
@@ -468,7 +470,7 @@ rescue_callback(VALUE arg)
VALUE msg = rb_funcall(e, rb_intern("message"), 0);
bt = rb_ary_entry(bt, 0);
error = rb_sprintf("%"PRIsVALUE": %"PRIsVALUE" (%s)\n", bt, msg, rb_obj_classname(e));
- rb_write_error(StringValuePtr(error));
+ rb_write_error_str(error);
rb_backtrace();
ruby_finalize();
exit(-1);
diff --git a/internal.h b/internal.h
index dc38623..dfd0984 100644
--- a/internal.h
+++ b/internal.h
@@ -872,7 +872,6 @@ const char *ruby_get_inplace_mode(void);
void ruby_set_inplace_mode(const char *);
ssize_t rb_io_bufread(VALUE io, void *buf, size_t size);
void rb_stdio_set_default_encoding(void);
-void rb_write_error_str(VALUE mesg);
VALUE rb_io_flush_raw(VALUE, int);
size_t rb_io_memsize(const rb_io_t *);
@@ -1353,6 +1352,7 @@ VALUE rb_ident_hash_new(void);
/* io.c (export) */
void rb_maygvl_fd_fix_cloexec(int fd);
int rb_gc_for_fd(int err);
+void rb_write_error_str(VALUE mesg);
/* numeric.c (export) */
VALUE rb_int_positive_pow(long x, unsigned long y);