[Lazarus] TDBImage -AV [SOLVED] for Jpeg images

Burkhard Carstens fpc at bcsoft.de
Thu Sep 4 15:14:45 CEST 2008


Am Donnerstag, 4. September 2008 13:41 schrieb Osvaldo Filho:
> > > line 175>>  if assigned(AGraphic) then AGraphic.Free;
>
> This is not the problem, the problem is the fact that this code never
> executed:
>          if assigned(gc) then
>            begin
>            AGraphic := gc.Create;
>            AGraphic.LoadFromStream(s);
>            Picture.Assign(AGraphic);
>            end;
>
> Perhaps the problem is in :
> FDataLink.DataSet.CreateBlobStream(FDataLink.Field,bmRead); //
> (lazarus team)
> or
> s.readansistring; (please, see original code)
> 2008/9/4 Burkhard Carstens <fpc at bcsoft.de>
>
> > Am Mittwoch, 3. September 2008 19:56 schrieb Osvaldo Filho:
> > [..]
> >
> > > > The AV ocour here:
> > > > dbimage.inc line 175
> > > > ----------------------
> > > >            Picture.Assign(AGraphic);
> > > >            end;
> > > >        finally
> > > > line 175>>  if assigned(AGraphic) then AGraphic.Free;
> > > >          s.Free;
> > > >        end {try}
> > > > ----------------------
> >
> > I didn't read the whole thread but one thing comes to mind:
> > AGraphics is a local var, so it is not initialized (IIRC).
> > Therefore
> > assigned(AGraphics) (which just checks for non-nil pointer) returns
> > probably true, even if it does not point to TGraphic instance. Just
> > adding "AGraphics:=nil" at the beginning of the procedure might
> > resolve the issue.

Sorry, I was just talking about the AV, which should not appear, even if 
GetGraphicClassForFileExtension(GraphExt) returns nil.

regards
 Burkhard




More information about the Lazarus mailing list