Who are the male heirs to Albany? Illegitimate male descendants and their descendants cannot be heirs to the dukedom.
By the Royal Marriages Act of 1772, when a descendant of King George II (other than the issue of princesses married into foreign families) contracted marriage without the consent of the monarch, the marriage was null and void, and consequently the couple's children were illegitimate.
https://www.legislation.gov.uk/apgb/Geo3/12/11/contents
For example, the Royal Marriages Act was followed when Prince Augustus Frederick, Duke of Sussex, married in breach of it. His marriage was declared null and void, and the couple's son Augustus Frederick d'Este was, as an illegitimate child, unable to inherit the dukedom of Sussex.
Per the author of Queen Victoria's Descendants, no descendant of the second Duke of Albany, Charles Edward, ever sought approval from the British monarch before marrying.
Therefore, so long as the Royal Marriages Act was maintained, the grandchildren of Charles Edward, and their heirs, were
illegitimate in the United Kingdom and excluded from the line of succession to the dukedom of Albany.
The Succession to the Crown Act of 2013 did legitimize marriages which were null and void under the Royal Marriages Act, but only if "in all the circumstances it was reasonable for the person concerned not to have been aware at the time of the marriage that the Act applied to it", per section 3, subsection 5 (a).
https://www.legislation.gov.uk/ukpga/2013/20
If it was
not reasonable for Duke Charles Edward's descendants to have been unaware that the Royal Marriages Act applied to them, then his heirs are still illegitimate in the United Kingdom and there are no heirs to the dukedom of Albany.
There is no legal barrier as far as I know. It is only that it would be toxic from a political point of view.
Yes, and the original poster was stating that she would like to keep it available for the royal family rather than losing it to for example Prince Louis's male heirs for the foreseeable future.
York is the only royal dukedom without a successor, and that is owed to chance. At the time that dukedoms are bestowed there is every reason to expect that there will be successors, especially in this traditional family in which marriage and childbearing are expected.