PR# 15918 Should freeze code when changing $-expressions.

Problem Report Summary
Submitter: dfurrer
Category: CECIL
Priority: Medium
Date: 2009/06/03
Class: Bug
Severity: Serious
Number: 15918
Release: 6.4.78984
Confidential: No
Status: Open
Environment: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: Gecko/2009051908 Firefox/3.0.11
Synopsis: Should freeze code when changing $-expressions.

Here's my original email to the mailing list and Manu's reply:

I keep running into strange issues with CECIL in the last few days.
I'm trying to pass out an object reference (and a feature pointer) to a c function to be able to call back later.

My initial code was like this:

setup ($Current, $method)
setup (object, method: POINTER)
setup (EIF_REFERENCE a_object, EIF_REFERENCE a_method) {
    object = eif_protect (a_object);

Now $Current often (or sometimes) seemed to be NULL, for reasons I do not know. (Could it have something to do with that I make the call from the creation procedure?)
I changed my code to the following, which suddenly worked as expected:

setup (Current, $method)
setup (object: like Current; method: POINTER)
setup (EIF_OBJECT a_object, EIF_REFERENCE a_method) {
    object = a_object;

But then later, in a slightly changed setup where setup is a method and object an instance variable it seems like all callbacks go to the same object and reverting to the first version of my code fixes that problem.
I'm very confused/frustrated about that.
Can you see what's wrong??

--- Emmanuel Stapf: ---
I think the issue is that it requires you to freeze whenever you do a change to
your call to `setup' but I'm not sure. If it is the case, please fill a problem

Freezing solves the problem indeed!
To Reproduce

Problem Report Interactions