Even the handguns I don't shoot (that are in the house and subject to being picked up for a range use or other use) get a field strip, inspection, wipe down with an oily cloth every few months.
The oily patch down the barrel has protected some of my old rifles for as long as 8 years. I had a batch of 03's, M1917, etc. in the attic for an 8 year stretch several years back. I pulled them down, laid them out in the floor and inspected/wiped them down again and they went into my new safe (were some have been for another 3 years). Absolutely no rust on them (well, no new rust in the case of that one M1917).
Hard to tell what happened to your pistol. Not much of a way to touch that part of the barrel. I say that because you can wipe a gun down, then touch the metal with your sweaty/oily fingers and it can then rust while it's sitting and waiting on your next use of it. Once you've wiped it down, don't have skin contact with the metal surfaces again.