[BUG] cfp consistency error in Win32OLE

e$B=uED$G$9!#e(B
e$B<!$N%9%/%j%W%H$re(Btrunke$B$G<B9T$9$k$He(B cfp consistency error
e$B$K$J$j$^$9!#e(B

require ‘win32ole’
ie = WIN32OLE.new(‘InternetExplorer.Application’)
ev = WIN32OLE_EVENT.new(ie)

ev.on_event(‘BeforeNavigate2’) {|*args|
raise “exception”
}
ie.gohome

error e$B$K$J$k$N$O!"%V%m%C%/$NCf$Ne(B raise “exception”
e$B$N$H$3$m$G$9!#e(B
(ie.gohomee$B$Ge(B BeforeNavigate2 e$B%$%Y%s%H$,H/@8$7!"e(B

win32ole.c e$B$G$$$&$He(B EVENTSINK_Invoke e$B$Ne(B

 result = rb_apply(handler, rb_intern("call"), args);

e$B$N9T$G!"%V%m%C%/$,%3!<%k$5$l$F!"$=$NCf$GNc30$,e(B raise
e$B$5$l$k$He(B
cfp consistency error e$B$K$J$j$^$9!#e(B
e$B$3$NA0$Ne(BGCe$BCf$Ke(BRubye$B%*%V%8%’%/%H$r:n$C$F$O$$$1$J$$$N$HF1MM!"e(BRubye$B$Ge(B
e$BA[Dj$7$F$$$k0J30$N$H$3$m$+$i!"e(B rb_apply
e$B$r8F$V$N$,$$$1$J$$$3$H$re(B
[email protected]$m$&$J$H;W$&$N$G$9$,!"2sHr:v$O$I$N$h$&$K$9$k$N$,$$$$e(B
e$B$s$G$7$g$&$+!)e(B

e$B%(%i!<$N=PNO$O<!$NDL$j$K$J$j$^$9!#e(B

– control frame ----------
c:td p:0074 s:td b:0009 l:tx d:tx TOP test.rb:8
c:td p:---- s:td b:0004 l:td d:td FINISH :private_class_method
c:td p:0000 s:td b:0002 l:td d:td TOP :455

– control frame ----------
c:td p:---- s:td b:0024 l:td d:td CFUNC :initialize
c:td p:---- s:td b:0022 l:td d:td CFUNC :new
c:td p:---- s:td b:0018 l:td d:td CFUNC :set_backtrace
c:td p:0009 s:td b:0016 l:tx d:td BLOCK test.rb:6
c:td p:---- s:td b:0015 l:td d:td FINISH :length
c:td p:---- s:td b:0013 l:td d:td CFUNC :call
c:td p:---- s:td b:0011 l:td d:td CFUNC :method_missing
c:td p:0074 s:td b:0009 l:tx d:tx TOP test.rb:8
c:td p:---- s:td b:0004 l:td d:td FINISH :private_class_method
c:td p:0000 s:td b:0002 l:td d:td TOP :455

test.rb:8: [BUG] cfp consistency error - call0
ruby 1.9.0 (2008-07-12 revision 18035) [i386-mswin32_80]

– control frame ----------
c:td p:---- s:td b:0013 l:td d:td CFUNC :call
c:td p:---- s:td b:0011 l:td d:td CFUNC :method_missing
c:td p:0074 s:td b:0009 l:tx d:tx TOP test.rb:8
c:td p:---- s:td b:0004 l:td d:td FINISH :private_class_method
c:td p:0000 s:td b:0002 l:td d:td TOP :455

DBG> : “test.rb:8:in call'" DBG> : "test.rb:8:inmethod_missing’”
DBG> : “test.rb:8:in `’”

This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application’s support team for more information.
test.rb:8: [BUG] Segmentation fault
ruby 1.9.0 (2008-07-12 revision 18035) [i386-mswin32_80]

– control frame ----------
c:td p:---- s:td b:0013 l:td d:td CFUNC :call
c:td p:---- s:td b:0011 l:td d:td CFUNC :method_missing
c:td p:0074 s:td b:0009 l:tx d:tx TOP test.rb:8
c:td p:---- s:td b:0004 l:td d:td FINISH :private_class_method
c:td p:0000 s:td b:0002 l:td d:td TOP :455

DBG> : “test.rb:8:in call'" DBG> : "test.rb:8:inmethod_missing’”
DBG> : “test.rb:8:in `’”

This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application’s support team for more information.

e$B=uEDe(B e$B2m5*e(B

e$B%o%J%Y$H?=$7$^$9!#e(B

2008/07/12 15:26 Masaki S. [email protected]:

ie.gohome
e$B$3$NA0$Ne(BGCe$BCf$Ke(BRubye$B%*%V%8%’%/%H$r:n$C$F$O$$$1$J$$$N$HF1MM!"e(BRubye$B$Ge(B
e$BA[Dj$7$F$$$k0J30$N$H$3$m$+$i!"e(B rb_apply e$B$r8F$V$N$,$$$1$J$$$3$H$re(B
[email protected]$m$&$J$H;W$&$N$G$9$,!"2sHr:v$O$I$N$h$&$K$9$k$N$,$$$$e(B
e$B$s$G$7$g$&$+!)e(B

Rubye$B$NA[Dj$7$F$$$k$H$3$m$KL5M}$d$jF~$C$F$7$^$($P$$$$!"$H9M$($^$9$He(B
Threade$B%%V%8%’%/%H$r:n$C$F$=$NCf$G=hM}$7$F$7$^$&$N$O$I$&$G$7$g$&$+!#e(B
e$B$?$H$($P!";W$$$D$-$N<B83E
%3!<%I$G$O$"$j$^$9$,$3$s$J46$8$G!#e(B

Index: win32ole.c

— win32ole.c (revision 18083)
+++ win32ole.c (working copy)
@@ -7425,6 +7425,30 @@
}
}

+VALUE EVENTSINK_Invoke_i(void *iargs)
+{

  • VALUE result;
  • VALUE vargs = (VALUE) iargs;
  • VALUE handler = vargs[0];
  • VALUE args = vargs[1];
  • ITypeInfo *pTypeInfo = (ITypeInfo *)vargs[2];
  • DISPID dispid = (DISPID)vargs[3];
  • DISPPARAMS *pdispparams = (DISPPARAMS *)vargs[4];
  • VARIANT *pvarResult = (VARIANT *)vargs[5];
  • result = rb_apply(handler, rb_intern(“call”), args);
  • if(TYPE(result) == T_HASH) {
  •  hash2ptr_dispparams(result, pTypeInfo, dispid, pdispparams);
    
  •  result = hash2result(result);
    
  • }
  • if (pvarResult) {
  •    ole_val2variant(result, pvarResult);
    
  • }
  • free(iargs);
  • return Qnil;
    +}

STDMETHODIMP EVENTSINK_Invoke(
PEVENTSINK pEventSink,
DISPID dispid,
@@ -7491,11 +7515,15 @@
}
}
else {

  •    result = rb_apply(handler, rb_intern("call"), args);
    
  • if(TYPE(result) == T_HASH) {
  •  hash2ptr_dispparams(result, pTypeInfo, dispid, pdispparams);
    
  •  result = hash2result(result);
    
  • }
  • VALUE *vargs = ALLOC_N(VALUE, 6);
  • vargs[0] = handler;
  • vargs[1] = args;
  • vargs[2] = pTypeInfo;
  • vargs[3] = dispid;
  • vargs[4] = pdispparams;
  • vargs[5] = pvarResult;
  • rb_thread_create(EVENTSINK_Invoke_i, (void*)vargs);
  • return NOERROR;
    }
    if (pvarResult) {
    ole_val2variant(result, pvarResult);

e$B=uED$G$9!#e(B

wanabe wrote:

Rubye$B$NA[Dj$7$F$$$k$H$3$m$KL5M}$d$jF~$C$F$7$^$($P$$$$!"$H9M$($^$9$He(B
Threade$B%*%V%8%’%/%H$r:n$C$F$=$NCf$G=hM}$7$F$7$^$&$N$O$I$&$G$7$g$&$+!#e(B

e$B$"$j$,$H$&$4$6$$$^$9!#e(B
e$BL5M}$d$jF~$kJ}K!$,$o$+$i$J$/$FG:$s$G$$$?$N$G$9$,!“e(BThreade$B%*%V%8%’%/%He(B
[email protected]@.$9$k$H$$$&H/A[$O$”$j$^$;$s$G$7$?!#e(B
[email protected]!“e(BThreade$B$rMxMQ$9$kJ}K!$,$$$$$N$+$I$&$+!”:#$N;d$K$O$h$/$o$+$j$^$;$s!#e(B

e$B0lC6e(B begin rescue end
e$B$G$/$/$C$FNc30$rJdB-$9$k$3$H$O$G$-$=$&$Je(B
e$B46$8$J$N$G!"e(BEVENTSINK_Invokee$B$rH4$1$?8e$GNc30$re(Braisee$B$9$kJ}K!$,e(B
e$B$J$$$+$H9M$($F$^$7$?!#e(B
rescuee$B$NCf$G%(%i!<>pJs$r=PNO$9$l$P!"e(Braisee$B$7$J$/$F$bH4$1$?D>8e$Ke(B
e$B%9%/%j%W%H$N<B9T$,=*N;$G$-$5$($9$l$P$$$$$N$G$9$,e(B…e$B!#e(B

e$B$?$H$($P!";W$$$D$-$N<B83E*%3!<%I$G$O$"$j$^$9$,$3$s$J46$8$G!#e(B

e$B$[$!"$=$N$^$^;n$7$F$_$?$N$G$9$,!“e(Bmake test-all TESTS=win32ole
e$B$OESCf$G%O%s%0%”%C%W$7$^$7$?!#e(B
e$B>$7$$$3$H$O!"$^[email protected];~4V$,<h$l$J$$$N$GD4$Y$F$^$;$s!#e(B

e$B$"$H!"e(B[ruby-dev:35450]e$B$N%9%/%j%W%H$O!"0[>o=*N;$7$J$/$J$j$^$7$?$,e(B
e$BNc30$b5/$3$j$^$;$s$G$7$?!#e(B

Thread#joine$B$He(BThread.abort_on_exceptione$B$b;H$($P2?$H$+$J$k$N$+$Je(B…e$B!#e(B

e$B=uEDe(B e$B2m5*e(B

e$B%o%J%Y$G$9!#e(B

2008/07/16 21:27 Masaki S. [email protected]:

Rubye$B$NA[Dj$7$F$$$k$H$3$m$KL5M}$d$jF~$C$F$7$^$($P$$$$!"$H9M$($^$9$He(B
Threade$B%*%V%8%’%/%H$r:n$C$F$=$NCf$G=hM}$7$F$7$^$&$N$O$I$&$G$7$g$&$+!#e(B

e$B$"$j$,$H$&$4$6$$$^$9!#e(B
e$BL5M}$d$jF~$kJ}K!$,$o$+$i$J$/$FG:$s$G$$$?$N$G$9$,!“e(BThreade$B%*%V%8%’%/%He(B
[email protected]@.$9$k$H$$$&H/A[$O$”$j$^$;$s$G$7$?!#e(B
[email protected]!“e(BThreade$B$rMxMQ$9$kJ}K!$,$$$$$N$+$I$&$+!”:#$N;d$K$O$h$/$o$+$j$^$;$s!#e(B

e$B$9$_$^$;$s!“4*0c$$$7$F$$$^$7$?!#e(B
[ruby-dev:35278] e$B$N%9%l%C%I$rFI$_JV$7$F5$$E$$$?$N$G$9$,e(B
OLE e$B$N%$%Y%s%H=hM}$OF14|=hM}$J$N$G$9$M!#e(B
e$B$G$7$?$ie(B Thread e$B$r;H$&$H$$$&$N$O$”$^$j0UL#$N$J$$Ds0F$G$7$?!#e(B

e$B%o%J%Y$G$9!#e(B

Thread e$B$r;H$o$:$KNc30$rJaB*$9$kJ}K!$r#1$D;W$$$D$-$^$7$?!#e(B
e$BFbIt$Ge(B rb_rescue e$BEy$GNc30$r<u$1<h$C$FJ]B8$7!“e(B
e$B0BA4$J>l=j$+$i$b$&0lEYDLCN$7$J$*$9$N$O$I$&$G$7$g$&$+!#e(B
e$B:#2s$b<B;HMQ$K$OBQ$($J$$%3!<%I$G$9$,!”%$%a!<%8$,EA$o$l$P9,$$$G$9!#e(B

Index: win32ole.c

— win32ole.c (revision 18123)
+++ win32ole.c (working copy)
@@ -3178,6 +3178,16 @@
return argv;
}

+static void
+check_err(VALUE self) {

  • VALUE err = rb_ivar_get(self, rb_intern(“err”));
  • if (!NIL_P(err)) {
  • rb_ivar_set(self, rb_intern(“err”), Qnil);
  • rb_funcall(rb_mKernel, rb_intern(“raise”), 1, err);
  • }
    +}

static VALUE
ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL
is_bracket)
{
@@ -3400,6 +3410,7 @@
StringValuePtr(cmd),
StringValuePtr(v));
}

  • check_err(self);
    obj = ole_variant2val(&result);
    VariantClear(&result);
    return obj;
    @@ -7425,6 +7436,21 @@
    }
    }

+VALUE EVENTSINK_Invoke_procall(VALUE *pargs)
+{

  • return rb_apply(pargs[0], rb_intern(“call”), pargs[1]);
    +}

+VALUE push_exc(VALUE obj, VALUE e)
+{

  • if (rb_obj_is_kind_of(obj, cWIN32OLE)) {
  • if (NIL_P(rb_ivar_get(obj, rb_intern(“err”)))) {
  •  rb_ivar_set(obj, rb_intern("err"), e);
    
  • }
  • }
  • return Qnil;
    +}

STDMETHODIMP EVENTSINK_Invoke(
PEVENTSINK pEventSink,
DISPID dispid,
@@ -7491,7 +7517,11 @@
}
}
else {

  •    result = rb_apply(handler, rb_intern("call"), args);
    
  • VALUE pargs[2];

  • pargs[0] = handler;

  • pargs[1] = args;

  •    result = rb_rescue(EVENTSINK_Invoke_procall, (VALUE) pargs,
    
  •     push_exc, rb_ivar_get(obj, rb_intern("ole")));
    

    if(TYPE(result) == T_HASH) {
    hash2ptr_dispparams(result, pTypeInfo, dispid, pdispparams);
    result = hash2result(result);
    @@ -7938,6 +7968,7 @@
    poleev->pConnectionPoint = pConnectionPoint;
    poleev->event_id = pIEV->m_event_id;

  • rb_ivar_set(self, rb_intern(“ole”), ole);
    return self;
    }

cfp consistency error e$B$N:,K\860x$bC5$C$F$$?$N$G$9$,CGG0$7$^$7$?!#e(B
e$B#22sL\0J9
$Ne(B EVENTSINK_Invoke e$B$N8F$S=P$7$Ge(B
rb_raise e$B$N%8%c%s%[email protected]$,$*$+$7$/$J$C$F$$$k$h$&$K8+<u$1$i$l$^$7$?$,e(B
e$B$=$l0J>eDI$$$-$l$^$;$s$G$7$?!#e(B

e$B=uED$G$9!#e(B
Masaki S. wrote:

e$B$?$H$($P!";W$$$D$-$N<B83E*%3!<%I$G$O$"$j$^$9$,$3$s$J46$8$G!#e(B

e$B$[$!"$=$N$^$^;n$7$F$_$?$N$G$9$,!“e(Bmake test-all TESTS=win32ole
e$B$OESCf$G%O%s%0%”%C%W$7$^$7$?!#e(B
e$B>$7$$$3$H$O!"$^[email protected];~4V$,<h$l$J$$$N$GD4$Y$F$^$;$s!#e(B

e$B$"$H!"e(B[ruby-dev:35450]e$B$N%9%/%j%W%H$O!"0[>o=*N;$7$J$/$J$j$^$7$?$,e(B
e$BNc30$b5/$3$j$^$;$s$G$7$?!#e(B

Thread#joine$B$He(BThread.abort_on_exceptione$B$b;H$($P2?$H$+$J$k$N$+$Je(B…e$B!#e(B

e$B;n$7$K!"e(BThread#joine$B$r%3!<%k$7$F$_$?$i!"e(Bmake test-all
TESTS=win32ole
e$B$O:G8e$^$G<B9T$G$-$k$h$&$K$J$j$^$7$?$,!"e(B[ruby-dev:35450]e$B$N%9%/%j%W%He(B
e$B$O!"e(Bcfp consistency error e$B$KLa$C$F$7$^$$$^$7$?!#e(B

e$B=uEDe(B e$B2m5*e(B

e$B=uED$G$9!#e(B

wanabe wrote:

Thread e$B$r;H$o$:$KNc30$rJaB*$9$kJ}K!$r#1$D;W$$$D$-$^$7$?!#e(B
e$BFbIt$Ge(B rb_rescue e$BEy$GNc30$r<u$1<h$C$FJ]B8$7!"e(B
e$B0BA4$J>l=j$+$i$b$&0lEYDLCN$7$J$*$9$N$O$I$&$G$7$g$&$+!#e(B

e$B<B$OF1$8$h$&$J$3$H$r9M$($F$$$^$7$?!#e(B
e$B0BA4$J>l=j$,e(BWin32OLEe$BFb$GNI$1$l$P$I$&$H$G$b$J$k$s$G$9$,e(B
e$B$=$&[email protected]$b$"$k$N$G!"$=$3$r$I$&$7$h$&$+$HG:$s$G$$$k$N$G$7$?!#e(B
e$BMpK=$G$9$,!"e(Brescuee$B$GNc30$r<u$1<h$C$?$H$3$m$G%(%i!<>pJs$re(B
e$B=PNO$7$F$+$i!"B(:B$Ke(Bexite$B$7$A$c$&$H$$$&<j$b9M$($F$$$^$7$?!#e(B

[email protected]=hM}7O$+$ie(BWin32OLEe$B$r;H$&$H:$$C$?$3$H$Ke(B

e$B$J$k$+$bCN$l$^$;$s$,e(B…e$B!#e(B

e$B%9%/%j%W%H$G=q$/$H$3$s$J46$8!#e(B
ev.on_event {|*args|
begin

rescue
STDERR.puts $!.message #e$B%(%i!<>pJs$r=PNOe(B
exit! #[email protected]$A$K=*N;e(B
end
}

cfp consistency error e$B$N:,K\860x$bC5$C$F$_$?$N$G$9$,CGG0$7$^$7$?!#e(B

e$B;d$bC5$j=P$;$J$$$G$$$^$9!#e(B

e$B=uEDe(B e$B2m5*e(B

[email protected]$G$9!#e(B

At Fri, 18 Jul 2008 18:13:26 +0900,
wanabe wrote in [ruby-dev:35576]:

if(TYPE(result) == T_HASH) {
hash2ptr_dispparams(result, pTypeInfo, dispid, pdispparams);
result = hash2result(result);

e$B3HD%%i%$%V%i%j$GNc30$r%H%i%C%W$9$k$N$G$"$l$P!"e(Brb_rescuee$B$h$j$be(B
rb_protecte$B$r;H$C$F$/[email protected]$5$$!#e(B

e$B=uED$G$9!#e(B

Nobuyoshi N. wrote:

e$B3HD%%i%$%V%i%j$GNc30$r%H%i%C%W$9$k$N$G$"$l$P!"e(Brb_rescuee$B$h$j$be(B
rb_protecte$B$r;H$C$F$/[email protected]$5$$!#e(B

e$B$=$&$$$($P!"e(Brb_protecte$B$NB8:_$rK:$l$F$$$^$7$?!#e(B
rb_protecte$B$r;H$&$h$&[email protected]$7$^$7$?!#e(B

e$B=uEDe(B e$B2m5*e(B

e$B=uED$G$9!#e(B

Masaki S. wrote:

e$BMpK=$G$9$,!"e(Brescuee$B$GNc30$r<u$1<h$C$?$H$3$m$G%(%i!<>pJs$re(B
e$B=PNO$7$F$+$i!"B(:B$Ke(Bexite$B$7$A$c$&$H$$$&<j$b9M$($F$$$^$7$?!#e(B

e$B<B:]$K;n$7$F$$?$i!"e(B_exit() e$B$G$O$J$/!“e(Bexit()e$B$G$bBg>fIWe(B
e$B$C$]$$$N$G!”%(%i!<>pJs$r<+NO$G=PNO$7$F!"e(Bexit()e$B$9$ke(B
e$B$h$&[email protected]$7$?$b$N$r%3%
%C%H$7$^$7$?!#e(B

e$B=uEDe(B e$B2m5*e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs