freepooma-devel
[Top][All Lists]
Advanced

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

[PATCH] Fix Engine<.., MultiPatch<..> >::makeOwnCopy()


From: Richard Guenther
Subject: [PATCH] Fix Engine<.., MultiPatch<..> >::makeOwnCopy()
Date: Tue, 22 Apr 2003 17:57:58 +0200 (CEST)

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]