erm
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
IoIxD 2026-09-11 21:25:13 -07:00
commit 6f4164da0c

View file

@ -13,11 +13,11 @@ MwBool MwWaylandVulkan = MwFALSE;
MwBool MwWaylandCairoOnly = MwFALSE; MwBool MwWaylandCairoOnly = MwFALSE;
static pthread_mutex_t destroyedWidgetsTableMutex; static pthread_mutex_t destroyedWidgetsTableMutex;
// /* /*
// * So Wayland, bless its soul; it keeps using callbacks LONG after they should not only be destroyed but the widget doesn't even exist anymore. Naturally, this causes use after free. so we fight fire with fire in the worst code i've ever written: by storing the freed pointers here, we disallow wayland from ever using them again. if something else is created that takes this slot, we remove it from the table. * So Wayland, bless its soul; it keeps using callbacks LONG after they should not only be destroyed but the widget doesn't even exist anymore. Naturally, this causes use after free. so we fight fire with fire in the worst code i've ever written: by storing the freed pointers here, we disallow wayland from ever using them again. if something else is created that takes this slot, we remove it from the table.
// * *
// * To illustrate how bad this code is: if Israel and Palestine found out I was doing this then the Israel/Palestine conflict would be solved because both world leaders would come to the conclusion that this code is the worst thing ever. * To illustrate how bad this code is: if Israel and Palestine found out I was doing this then the Israel/Palestine conflict would be solved because both world leaders would come to the conclusion that this code is the worst thing ever.
// */ */
static MwLL* destroyedWidgetsTable; static MwLL* destroyedWidgetsTable;
MwBool MwLLWaylandWidgetIsDestroyed(MwLL self) { MwBool MwLLWaylandWidgetIsDestroyed(MwLL self) {
@ -862,7 +862,12 @@ static void widget_setup(MwLL r, MwLL parent, int x, int y, int width, int heigh
r->wayland.x = x; r->wayland.x = x;
r->wayland.y = y; r->wayland.y = y;
r->wayland.parent = parent; r->wayland.parent = parent;
r->wayland.valid = MwTRUE; if(MwLLWaylandWidgetIsDestroyed(parent)) {
r->wayland.valid = MwFALSE;
return;
} else {
r->wayland.valid = MwTRUE;
}
if(ty == MwLL_WAYLAND_UNKNOWN) { if(ty == MwLL_WAYLAND_UNKNOWN) {
if(parent == NULL) { if(parent == NULL) {
@ -1064,9 +1069,9 @@ static void MwLLDestroyImpl(MwLL handle) {
printf("widget invalid\n"); printf("widget invalid\n");
} }
// pthread_mutex_lock(&destroyedWidgetsTableMutex); pthread_mutex_lock(&destroyedWidgetsTableMutex);
// arrput(destroyedWidgetsTable, handle); arrput(destroyedWidgetsTable, handle);
// pthread_mutex_unlock(&destroyedWidgetsTableMutex); pthread_mutex_unlock(&destroyedWidgetsTableMutex);
free(handle); free(handle);
} }