#1 2018-04-26 15:28:24

CycleSoft
Member
Registered: 2013-01-18
Posts: 34

input param on an interface-based method generates AV

Hi Arnaud,

starting from this (github) commit:

commit e4e52e6605cb7935c1828c93fcff979cb8092ae5 (HEAD)
Author: Arnaud Bouchez <fakeaddress@synopse.info>
Date:   Fri Apr 7 20:02:16 2017 +0200

    refactored JSONToObject() to use OOP for maintainability

I got a problem:

I define a method like this:

    procedure Proc3(Dummy: integer; InParam: TMyClass; out Param1: TMyClass);

the method is successfully called, but an 'Invalid pointer operation' is raised exiting the method implementation.

Note that the problem arises only if the input parameter of type object is defined.
on

    procedure Proc2(Dummy: integer; out Param1: TMyClass);

there are no problems.

I tracked down the issue until the TServiceMethodExecute.AfterExecute procedure:

    for i := 0 to ArgsUsedCount[smvvObject]-1 do
      fObjects[ i ].Free;

It seems that the fObjects[0] reference (the input parameter) is not valid when Free is called.

With the previous commit, the problem is not there.

To ease your debug, I uploaded to

  https://drive.google.com/file/d/1S7OcY2 … sp=sharing

a small demo that triggers the problem when Proc3 is called ( eg pointing a browser to http://localhost/root/test/proc3?Dummy=42 )

Thanks a lot fr your support!

Last edited by CycleSoft (2018-04-26 16:37:42)

Offline

#2 2018-04-26 16:57:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: input param on an interface-based method generates AV

This was indeed a very nasty bug... sad

Thanks to your simple project to reproduce the problem, I was able to fix it quickly.
See https://synopse.info/fossil/info/21c90be709

Thanks for the very good report!

Offline

#3 2018-04-26 17:45:44

CycleSoft
Member
Registered: 2013-01-18
Posts: 34

Re: input param on an interface-based method generates AV

You guys have the best support a developer can dream!
Many thanks for the quick fix!!

Offline

Board footer

Powered by FluxBB