[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

[MD:7181] Re: Crash in openp().



藤井です。

# meadow-develop に振ります。

From: Kyotaro HORIGUCHI <horiguti@xxxxxxxxxxx>
Subject: Crash in openp().
Date: Mon, 30 Jan 2006 20:48:08 +0900 (JST)
> > 以下の ChangeLog.Meadow のエントリを見るかぎりでは、rev4006 で
> > sys_spawnve に導入された変数 decoded_program にも GC 対策が必要なのでは
> > ないでしょうか?
> 
>  それはしたはずでは.. と思ったら..
>  後のほうの処置が抜けていたようです. すみません.
> 
> > +      struct gcpro gcpro1;
> > +
> > +      GCPRO1 (decoded_program);
> 
>  programm もこの後で使うので仲間に入れてあげてください.

program の方は、以下のようにコピーをとるように修正しているので、GC によ
る保護は不要になったのではないのでしょうか?
------------------------------------------------------------
  /* make sure argv[0] and cmdname are both in DOS format */
#ifdef MEADOW
  /* alloc new memory to cmdname to make argv[0] be GC-safe */
  cmdname = (char *) alloca (SBYTES (program) + 1);
  strcpy (cmdname, SDATA (program));
#else
  cmdname = SDATA (program);
#endif
------------------------------------------------------------
GC で保護するのなら、文字列をコピーするのをやめた方がいいと思います。

> なのでこんな感じです. これで commit します.
> 
> Index: w32proc.c
> ===================================================================
> --- w32proc.c	(revision 4012)
> +++ w32proc.c	(working copy)
> @@ -855,8 +855,15 @@
>    {
>      Lisp_Object func, arg, result, decoded_cmdname;
>  
> -    func = call1 (intern ("find-process-argument-editing-function"),
> -		  decoded_program);
> +    {
> +      struct gcpro gcpro1, gcpro2;
> +
> +      GCPRO2(program, decoded_program);
> +      func = call1 (intern ("find-process-argument-editing-function"),
> +		    decoded_program);
> +      UNGCPRO;
> +    }
> +
>      if (NILP (func))
>        {
>  	arglen = 0;

call1 は内部で引数が GCPRO されることが保証されていると考えていいのでしょ
うか?私はそのあたりが良く分かってなかったので、rev4015 で
decoded_program を GCPRO するコードを commit したのですが。

# 実装を見る限りでは call0 〜 call6 は Ffuncall の引数 GCPRO 付きラッパー
# に見えるので、GCPRO する必要ないと思うのですが。

--
藤井 正行 / Masayuki FUJII