Union of Hungary and Poland

The personal union between the Kingdom of Hungary and the Kingdom of Poland was achieved twice: under Louis I of Hungary in 1370–1382 and under Władysław III of Poland in 1440–1444.
Angevin union.
The first union came about when the last Piast king of Poland, Casimir III, designated his sororal nephew, the Angevin king Louis I of Hungary, as his heir presumptive by the Privilege of Buda. Upon the death of Casimir, who left no legitimate sons, Louis ascended the Polish throne virtually unopposed. The Polish nobility welcomed his accession, rightly believing that Louis would be an absentee king who would not take much interest in Polish affairs. He sent his mother Elizabeth, sister of Casimir III, to govern Poland as regent. Louis probably considered himself first and foremost king of Hungary; he visited his northern kingdom three times and spent there a couple of months altogether. Negotiations with the Polish nobility frequently took place in Hungary. Hungarians themselves were unpopular in Poland, as was the king's Polish mother who governed the kingdom. In 1376, "circa" 160 Hungarians in her retinue were massacred in Kraków and the queen returned to Hungary disgraced. Louis replaced her with their relative, Vladislaus II of Opole.
During Romanticism, Hungarian historians portrayed the union as an annexation of Poland into Hungary. In 1845, Sándor Petőfi wrote that "the falling stars of the north, the east and the south were all extinguished in Hungarian seas". In reality, Poland's independence remained largely uncompromised. King Louis saw to it that Hungarian influence in Poland was not greater than Polish influence in Hungary.
The union fell apart after Louis died in 1382. The dissatisfied Polish "szlachta" demanded that his successor in Hungary, Mary, move to Kraków and reign over Hungary and Poland from there. Mary's mother, Elizabeth of Bosnia (widow of Louis and grandniece of Casimir III's father, Vladislaus I), knew that the lack of supporters would render her influence at least as restricted as that of her mother-in-law and refused to move. She abandoned the idea of attempting to subdue the Polish nobility by force and agreed to send her younger surviving daughter, Hedwig, to be crowned as Louis' successor in Poland. The union had lasted little more than a decade and ended as peacefully as it had started.
Jagiellonian union.
By the end of the century, Louis had no descendants. Both Mary and Hedwig had died, the former heavily pregnant and the latter soon after giving birth to a short-lived daughter. In 1440, Vladislaus III of Poland, son of Hedwig's widower and successor Władysław II Jagiełło, was elected king of Hungary. The election was fiercely disputed by Elizabeth of Luxembourg, daughter of Mary's widower and successor Sigismund. A two-year civil war ensued, ending upon Elizabeth's death in 1442. Vladislaus' own death in battle in 1444 ended the union.