Stash value before sending message-- message may be deleted immediately.
[charm.git] / src / libs / ck-libs / tcharm / tcharm.C
index e2c14d69892d4948bcb11f757a9784455c4e3e95..eced8bfe9de8086ec284424dab9ef0e71cf5702d 100644 (file)
@@ -216,8 +216,9 @@ static void TCharmBuildThreads(TCharmInitMsg *msg,TCharmSetupCookie &cook)
                propMapID=CkCreatePropMap();
        }
        opts.setMap(propMapID);
+       int nElem=msg->numElements; //<- save it because msg will be deleted.
        CkArrayID id=CProxy_TCharm::ckNew(msg,opts);
-       cook.setThreads(id,msg->numElements);
+       cook.setThreads(id,nElem);
 }
 
 /****** Readonlys *****/