From 6be942f6da71152a6b20c8f5cd979d399611b005 Mon Sep 17 00:00:00 2001
From: Philippe Canal <pcanal@fnal.gov>
Date: Thu, 17 Jul 2008 22:08:38 +0000
Subject: [PATCH] Fix the problem reported at:
 http://root.cern.ch/phpBB2/viewtopic.php?t=6989. Undo temporary fix done in
 revision 24813. The issue was that the StreamerInfo for a class version '1'
 was mistakenly matched with the version 2 of the class (because both had the
 same checksum and the system used an algorithm reserved for non-versioned
 classes).

git-svn-id: http://root.cern.ch/svn/root/trunk@24875 27541ba8-7e3a-0410-8455-c3a389f83636
---
 core/meta/src/TClass.cxx    |  2 +-
 io/io/src/TStreamerInfo.cxx | 33 +++------------------------------
 2 files changed, 4 insertions(+), 31 deletions(-)

diff --git a/core/meta/src/TClass.cxx b/core/meta/src/TClass.cxx
index 4f6bca68799..d725543c5dc 100644
--- a/core/meta/src/TClass.cxx
+++ b/core/meta/src/TClass.cxx
@@ -4477,7 +4477,7 @@ TVirtualStreamerInfo *TClass::FindStreamerInfo(UInt_t checksum) const
       TVirtualStreamerInfo *info = (TVirtualStreamerInfo*)GetStreamerInfos()->At(i);
       if (!info) continue;
       if (info->GetCheckSum() == checksum) {
-         //R__ASSERT(i==info->GetClassVersion() || (i==-1&&info->GetClassVersion()==1));
+         R__ASSERT(i==info->GetClassVersion() || (i==-1&&info->GetClassVersion()==1));
          return info;
       }
    }
diff --git a/io/io/src/TStreamerInfo.cxx b/io/io/src/TStreamerInfo.cxx
index c74d09a141d..4c0898e742f 100644
--- a/io/io/src/TStreamerInfo.cxx
+++ b/io/io/src/TStreamerInfo.cxx
@@ -510,35 +510,6 @@ void TStreamerInfo::BuildCheck()
             }
          }
       }
-            
-
-
-//       searchOnChecksum = kTRUE;
-
-//       // If we have a foreign class, we need to search for
-//       // a StreamerInfo with same checksum.
-//       Bool_t searchOnChecksum = kFALSE;
-//       if (fClass->IsLoaded()) {
-//          if (fClass->IsForeign()) {
-//             searchOnChecksum = kTRUE;
-//          }
-//       } else {
-//          // When the class is not loaded the result of IsForeign()
-//          // is not what we are looking for (technically it means
-//          // IsLoaded() and there is no Streamer() method).
-//          //
-//          // A foreign class would have the ClassVersion equal to 1.
-//          // Also we only care if a StreamerInfo has already been loaded.
-//          if (fClassVersion == 1) {
-//             TStreamerInfo* v1 = (TStreamerInfo*) array->At(1);
-//             if (v1) {
-//                if (fCheckSum != v1->GetCheckSum()) {
-//                   searchOnChecksum = kTRUE;
-//                   fClassVersion = array->GetLast() + 1;
-//                }
-//             }
-//          }
-//       }
 
       if (!searchOnChecksum) {
          if (fClassVersion < array->GetEntriesFast()) {
@@ -551,7 +522,9 @@ void TStreamerInfo::BuildCheck()
             if (!info) {
                continue;
             }
-            if (fCheckSum == info->GetCheckSum()) {
+            if (fCheckSum == info->GetCheckSum() && (info->GetOnFileClassVersion()==1 || info->GetOnFileClassVersion()==0)) {
+               // We must match on the same checksum, an existing TStreamerInfo
+               // for one of the 'unversioned' class layout (i.e. version was 1).
                fClassVersion = i;
                break;
             }
-- 
GitLab