I imagine the rules and best practices would vary between jurisdictions, but basically yeah. But as soon as you file for the patent, you can release source and enjoy the confusion.
(Based on 30 seconds of googling, it seems that the USA and Australia gives inventors a 1 year grace period after publishing, but the granted patent might not be valid in other countries.)
USA also used to not consider publications or patents published outside USA as prior art, to the point of granting patents that were rewritten from someone else's patent in another country.
Not sure if it got better or worse with WTO patent rules.
Considering the history of NAND flash amounts to Toshiba applying to Japan's patent office and getting laughed out of the room, then Sandisk saw it and applied for and received a patent for NAND flash from the US Patent Office, it's probably still the case.
(Based on 30 seconds of googling, it seems that the USA and Australia gives inventors a 1 year grace period after publishing, but the granted patent might not be valid in other countries.)