Subject GetBookmark - The Fix
Author m. Th.
WRT to the 'GetBookmark' thread, there is a bug in Bookmark engine in
TIBO layer.

In short, the following existing code...

function TIBODataSet.GetBookmark: TBookmark;
var
B: AnsiString;
begin
B := GetBookmarkStr;
Result := nil;
if B <> '' then
begin
Result := AllocMem( BookmarkSize );
{$IFDEF IBO_VCL2009_OR_GREATER}
Move( pointer( B )^, Result[0], BookmarkSize ); //<--- AV here!
{$ELSE}
Move( pointer( B )^, Result^, BookmarkSize );
{$ENDIF}
end;
end;


...throws an AV because Result is an array and it should properly
initialized.

So, the fix looks like:

function TIBODataSet.GetBookmark: TBookmark;
var
B: AnsiString;
begin
B := GetBookmarkStr;
if B <> '' then
begin
{$IFDEF IBO_VCL2009_OR_GREATER}
SetLength(Result, BookmarkSize);
Move( pointer( B )^, Result[0], BookmarkSize );
{$ELSE}
Result := AllocMem( BookmarkSize );
Move( pointer( B )^, Result^, BookmarkSize );
{$ENDIF}
end
else
Result:=nil;
end;


...I changed a little bit the logic because having a 'Result=nil' and
after this a SetLength can be 'odd' for the compiler sometimes...

HTH,

m. Th.


[Non-text portions of this message have been removed]