freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [pooma-dev] [PATCH] Fix Engine<.., MultiPatch<..> >::makeOwnC opy()


From: James Crotinger
Subject: RE: [pooma-dev] [PATCH] Fix Engine<.., MultiPatch<..> >::makeOwnC opy()
Date: Tue, 22 Apr 2003 11:43:37 -0600

Hmmm. I don't have time to play with this, but something looks wrong. The sequence

        data_m.makeOwnCopy();
        if (data_m.isShared())

the isShared() test should always return false after a call to makeOwnCopy - that should be an invariant property of any ref-counted thing. That was certainly my intention.

        Jim

------------------------------------------------------------------------
James A. Crotinger                           email:     address@hidden
NumeriX, LLC                                 phone:  (505) 424-4477 x104
2960 Rodeo Park Dr. W.
Santa Fe, NM 87505
 

-----Original Message-----
From: Richard Guenther [mailto:address@hidden]
Sent: Tuesday, April 22, 2003 9:58 AM
To: address@hidden
Cc: Jeffrey D. Oldham
Subject: [pooma-dev] [PATCH] Fix Engine<.., MultiPatch<..> >::makeOwnCopy()

Hi!

Currently for a multipatch engine makeOwnCopy() does no good (it doesnt
copy), it seems because just calling makeOwnCopy() on the
RefCountedBlockPtr does not copy the underlying engines. I didnt figure
out why and so came up with the following fix which works for me. I have
also an updated Field/BasicTest3.cpp which now checks every engine
combination for makeOwnCopy and it now succeeds for both MultiPatch<Brick>
and MultiPatch<Remote<Brick> >.

Ok to apply?

Richard.


2003 Apr 22  Richard Guenther <address@hidden>

        * Engine/MultiPatchEngine.cpp: do makeOwnCopy() manually.

===== MultiPatchEngine.cpp 1.3 vs edited =====
--- 1.3/r2/src/Engine/MultiPatchEngine.cpp      Fri Jan 24 10:35:52 2003
+++ edited/MultiPatchEngine.cpp Tue Apr 22 17:42:04 2003
@@ -244,8 +244,17 @@
 Engine<Dim, T, MultiPatch<LayoutTag,PatchTag> >::
 makeOwnCopy()
 {
-  data_m.makeOwnCopy();
-
+  PAssert(data_m.isValid());
+  if (data_m.isShared()) {
+    PatchContainer_t model = data_m;
+    data_m = PatchContainer_t(model.size());
+    for (int i=0; i<model.size(); ++i) {
+      data_m[i] = model[i];
+      data_m[i].makeOwnCopy();
+    }
+    pDirty_m = new bool(*pDirty_m);
+  }
+
   return *this;
 }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]