11.3.1 windows 3.1
I can reproduce a gpf with the following code, and was wondering if anyone else could as well
/** temp/bar.cls */ routine-level on error undo, throw. using Progress.Lang.*. class temp.bar: constructor bar(): foo(). end constructor. method public character getFolder(): return "c:\temp". end method. method protected void foo(): def var lv_path as char no-undo. /** create new directory instance, run create method using getFolder method */ new temp.directory():create(substitute("&1/.backup",getFolder())). /** use static property to create new directory instance, run create method using substitute() */ temp.io:directory:create(substitute("&1/.backup","c:\temp")). assign lv_path = substitute("&1/.backup",getFolder()). /** use static property to create new directory instance, run create method using string literal */ temp.io:directory:create(lv_path). /** use static property to create new directory instance, run create method using getFolder method */ temp.io:directory:create(substitute("&1/.backup",getFolder())). /** avm crashes . So, using a combination of static property and method causes this, as other combinations don't */ message "will not see this message" view-as alert-box. end method. end class.
/** temp/io.cls */ class temp.io: def static property directory as temp.directory no-undo get(): return new temp.directory(). end get . private set. end class
/** temp/directory.cls */ class temp.directory: method public void create(p_dir as char): end method. end class.
and then running
/** temp/foobar.p */ new temp.bar().
I get:
** Unable to understand after -- ".directory()". (247)
** ./temp/bar.cls Could not understand line 19. (198)
10.2B, Linux
11.2 barfs with the same error.
thanks Tom.
10.2B ::
change
new temp.directory():create(substitute("&1/.backup",getFolder())).
to
(new temp.directory()):create(substitute("&1/.backup",getFolder())).
On 14 April 2014 14:52, ChUIMonster
wrote:
> RE: bug with statics and method calls
> Reply by ChUIMonster
>
> 11.2 barfs with the same error.
>
> Stop receiving emails on this subject.
>
> Flag this post as spam/abuse.
--
Julian Lyndon-Smith
IT Director,
dot.r
http://www.dotr.com
"The bitterness of poor quality remains long after the sweetness of
low price is forgotten”
Follow dot.r on http://twitter.com/DotRlimited
Yes, this can be reproduced in 11.3.2 too. But we have recently fixed a bug that has to do with garbage collection happening too soon on a chained reference and the crash cannot be reproduced anymore (this issue will be fixed in the next 11.3 service pack). As a workaround, break up the statement so that either:
- the object being new'ed during the chained call is assigned to a variable.
- the method call getFolder() is not executed in the same statement.
For example, the statement before the message statement in temp.bar:foo() could be changed to :
dir1 = temp.io:directory.
dir1:create(substitute("&1/.backup",getFolder())).
or
var1 = getFolder().
temp.io:directory.create(substitute("&1/.backup",var1)).
thanks Fernando. Do you want me to log a bug anyway ? At least then
you can reference that the bug was fixed in the SP.
Julian
On 14 April 2014 15:50, Fernando Souza
wrote:
> RE: bug with statics and method calls
> Reply by Fernando Souza
>
> Yes, this can be reproduced in 11.3.2 too. But we have recently fixed a bug
> that has to do with garbage collection happening too soon on a chained
> reference and the crash cannot be reproduced anymore (this issue will be
> fixed in the next 11.3 service pack). As a workaround, break up the
> statement so that either:
>
> - the object being new'ed during the chained call is assigned to a variable.
>
> - the method call getFolder() is not executed in the same statement.
>
> For example, the statement before the message statement in temp.bar:foo()
> could be changed to :
>
> dir1 = temp.io:directory.
>
> dir1:create(substitute("&1/.backup",getFolder())).
>
> or
>
> var1 = getFolder().
>
> temp.io:directory.create(substitute("&1/.backup",var1)).
>
> Stop receiving emails on this subject.
>
> Flag this post as spam/abuse.
--
Julian Lyndon-Smith
IT Director,
dot.r
http://www.dotr.com
"The bitterness of poor quality remains long after the sweetness of
low price is forgotten”
Follow dot.r on http://twitter.com/DotRlimited
Feel free to log a call with Technical Support. Please, just make sure you add a note that this is a known issue.
logged as #00272323 . I have indicated your comments in the description . Thanks
To close the loop on this, defect number is PSC00261756.
Full details are in the KB article 000049128 - Session crashes on chained reference, where new object instance is returned from a static property
thanks Frank