Could be that this is intentional, but doesn't look right to me.
map.setBaseLayer assigns oldBaseLayer to this.baseLayer. Then below, this.baseLayer is set to newBaseLayer (which also sets oldBaseLayer to newBaseLayer). It could be that there is some trickery intended here, but I think it's misleading at best.
I think the real thing that is meant to be tracked is the old base layer extent. The following patch does that.
This problem creeps up when you use the layer switcher to change from MetaCarta to VirtualEarth given the following markup:
<html>
<head>
<title>Test</title>
<style type="text/css">
#map {
width: 300px;
height: 300px;
border: 1px solid gray;
}
</style>
<script src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js " type="text/javascript"></script>
<script src="../lib/OpenLayers.js"></script>
</head>
<body>
<div id="map"></div>
<script defer="defer" type="text/javascript">
var map = new OpenLayers.Map('map');
var virtualearth = new OpenLayers.Layer.VirtualEarth("VirtualEarth");
var metacarta = new OpenLayers.Layer.WMS(
"Metacarta",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'});
map.addLayers([metacarta, virtualearth]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.OverviewMap());
map.setCenter(new OpenLayers.LonLat(5.69, 50.85), 15);
</script>
</body>
</html>