[PATCH] check for iface->ref to avoid crash

Robert Shearman rob at codeweavers.com
Wed May 7 05:17:02 CDT 2008


Marcus Meissner wrote:
> @@ -742,6 +742,9 @@ static void write_c_method_def(FILE *header, const type_t *iface)
>  
>  static void write_c_disp_method_def(FILE *header, const type_t *iface)
>  {
> +  if (!iface->ref) {
> +    error_loc("write_c_disp_method_def: no reference on interface(%p)\n", iface);
> +  }
>    do_write_c_method_def(header, iface->ref, iface->name);
>  }
>   

This can't ever happen. dispinterfaces always derive from IDispatch:
> dispinterfacehdr: attributes dispinterface      { attr_t *attrs;
>                                                   is_in_interface = TRUE;
>                                                   is_object_interface 
> = TRUE;
>                                                   $$ = $2;
>                                                   if ($$->defined) 
> error_loc("multiple definition error\n");
>                                                   attrs = 
> make_attr(ATTR_DISPINTERFACE);
>                                                   $$->attrs = 
> append_attr( check_dispiface_attrs($2->name, $1), attrs );
>                                                   $$->ref = 
> find_type("IDispatch", 0);
>                                                   if (!$$->ref) 
> error_loc("IDispatch is undefined\n");
>                                                   $$->defined = TRUE;
>                                                   if (!parse_only && 
> do_header) write_forward($$);
>                                                 }


-- 
Rob Shearman




More information about the wine-devel mailing list