A party selects their candidate for an election through an open primary election. The outcome of the primary is an unambiguous winner. After the primary, but before candidacy for the actual election opens, the winner of the primary experiences a marked loss of popularity. Either they renounce the candidacy, or many supporters of their party really wish they would. Or, for that matter, winner of the primary dies or otherwise becomes ineligible. There is no defined procedure to handle this case, or any local tradition to follow.
What precedents exist for this situation around the world, either in terms of what has actually happened, or in terms of defined procedures? Among places where primaries are held, what are typical rules to select a new candidate after a primary has been held but before the official election process starts? Note that in the scenario I'm asking about, the primary is a direct election, it isn't like in the US where the primary designates delegates who are expected to use their better judgement if an exceptional situation happens.
(The motivation of my question is the French mainstream right wing candidate for the 2017 Presidential election, who was selected in a primary but has been caught up by a corruption scandal which makes it likely that he won't be running in the election after all. Primaries are a pretty new thing in France — it's the first time the right has done that — and this scenario had not been planned for. Assuming that the party decided to try to capture the spirit of the primary as opposed to letting it come down to internal power plays, what experience could they draw upon?)