Why is masturbation regarded as breaking the fast, when the same does not apply to wanton display of beauty (tabarruj) and other sins?
Question

                In the answer to question no. 221471, you stated that if a person masturbates during the month of Ramadan, knowing that this act is prohibited, but not knowing at the time that masturbation renders the fast invalid, then his fast is rendered invalid because he is obliged to refrain from masturbating once he knows that it is prohibited. But in the answer to question no. 107624, you stated that if a woman does not wear hijab when she knows that what she is doing is prohibited, her fast is not rendered invalid because of this sin. What is the difference between the two cases?
Praise be to Allah.The things that break the fast are specific things that are clearly mentioned in the Qur’an and Sunnah. They are: intercourse; eating and drinking, and things that come under the same heading as eating and drinking, such as injections that provide nutrients; masturbation; cupping (hijaamah); vomiting deliberately; and menstruation. This has been explained previously in fatwa no. 38023. 
The difference between masturbation and making a wanton display of one’s beauty (tabarruj), with regard to fasting, is that masturbation in and of itself breaks the fast and is contrary to fasting. The evidence for that is the report narrated by al-Bukhaari (1894) and Ahmad (9112) from Abu Hurayrah (may Allah be pleased with him), according to which the Messenger (blessings and peace of Allah be upon him) said: “Allah, may He be glorified and exalted, said: ‘Fasting is for Me and I shall reward for it. He gives up his food, his drink and his desires for My sake…’” Masturbation comes under the heading of desire, therefore it invalidates the fast, just like food and drink. 
Ibn Hajar al-Haytami (may Allah have mercy on him) said: Masturbation invalidates the fast in and of itself. 
End quote from al-Fataawa al-Fiqhiyyah al-Kubra (2/73). 
Shaykh Muhammad al-Mukhtaar ash-Shinqeeti said: 
The word “his desire” is general in meaning and includes sexual desire, whether that is by way of intercourse or by way of masturbation. If a person ejaculates, he has fulfilled his desire, which is sexual desire. Based on that, he is regarded as no longer fasting, because the one who fasts gives up this desire, but the one who masturbates has not given up this desire. 
End quote from Sharh Zaad al-Mustaqni‘ (104/4) 
In al-Mawsoo‘ah al-Fiqhiyyah (4/100) it says: 
Masturbation with one’s hand invalidates the fast according to the Maalikis, Shaafa‘is and Hanbalis, and most of the Hanafis are also of this view. End quote. 
As for making a wanton display of one’s beauty, it is not one of the things that break the fast. Rather it is like other sins, such as backbiting and lying: it detracts from the reward of the fast but it does not render it invalid. 
In the answer to question no. 50063, we explained that sins (including a woman making a wanton display of her beauty and charms in front of non-mahram men) detract from the reward of the fast, and that committing a lot of sins may take away the reward of fasting altogether, but that does not render the fast invalid; rather the fast remains valid and discharges the duty of the fasting person, and he is not instructed to make up the fast. 
And Allah knows best.