When a charge containing more heads than one is framed against the same person, and when a conviction has been had on one or more of them, the complainant, or the officer conducting the prosecution, may, with the consent, of the court, withdraw the remaining charge or charges, or the court of its own accord may stay the inquiry into, or trial of, such charge or charges and such withdrawal shall have the effect of an acquittal on such charge or charges, unless the conviction be set aside, in which case the said court (subject to the order of the court setting aside the conviction) may proceed with the inquiry into, or trial of, the charge or charges so withdrawn.