forked from pyrite-dev/milsko
fix wayland crash by having MwLLDestroy flush before actually destroying handle
This commit is contained in:
parent
64930db2fc
commit
a0c864d85b
1 changed files with 16 additions and 8 deletions
|
|
@ -1949,6 +1949,11 @@ static void MwLLDestroyImpl(MwLL handle) {
|
||||||
};
|
};
|
||||||
int select_ret;
|
int select_ret;
|
||||||
|
|
||||||
|
event_loop(handle);
|
||||||
|
// wl_display_cancel_read(handle->wayland.display);
|
||||||
|
|
||||||
|
wl_flush(handle);
|
||||||
|
|
||||||
if(pthread_mutex_timedlock(&handle->wayland.eventsMutex, &t) != 0) {
|
if(pthread_mutex_timedlock(&handle->wayland.eventsMutex, &t) != 0) {
|
||||||
printf("WARNING: Couldn't call MwLLDestroyImpl due to deadlock.\n");
|
printf("WARNING: Couldn't call MwLLDestroyImpl due to deadlock.\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -1956,12 +1961,6 @@ static void MwLLDestroyImpl(MwLL handle) {
|
||||||
|
|
||||||
MwLLDestroyCommon(handle);
|
MwLLDestroyCommon(handle);
|
||||||
|
|
||||||
if(!handle->wayland.dbus_conn) {
|
|
||||||
dark_theme_detection_destroy(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
event_loop(handle);
|
|
||||||
|
|
||||||
/* sleep long enough that any active attempts to wait for the mutex will have given up and we can safely unlock/destroy it */
|
/* sleep long enough that any active attempts to wait for the mutex will have given up and we can safely unlock/destroy it */
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = 1000;
|
tv.tv_usec = 1000;
|
||||||
|
|
@ -1972,7 +1971,10 @@ static void MwLLDestroyImpl(MwLL handle) {
|
||||||
pthread_mutex_unlock(&handle->wayland.eventsMutex);
|
pthread_mutex_unlock(&handle->wayland.eventsMutex);
|
||||||
pthread_mutex_destroy(&handle->wayland.eventsMutex);
|
pthread_mutex_destroy(&handle->wayland.eventsMutex);
|
||||||
|
|
||||||
// framebuffer_destroy(&handle->wayland);
|
if(!handle->wayland.dbus_conn) {
|
||||||
|
dark_theme_detection_destroy(handle);
|
||||||
|
}
|
||||||
|
|
||||||
buffer_destroy(&handle->wayland.cursor);
|
buffer_destroy(&handle->wayland.cursor);
|
||||||
wl_region_destroy(handle->wayland.region);
|
wl_region_destroy(handle->wayland.region);
|
||||||
|
|
||||||
|
|
@ -2005,7 +2007,12 @@ static void MwLLDestroyImpl(MwLL handle) {
|
||||||
shfree(handle->wayland.wl_protocol_map);
|
shfree(handle->wayland.wl_protocol_map);
|
||||||
shfree(handle->wayland.wl_protocol_setup_map);
|
shfree(handle->wayland.wl_protocol_setup_map);
|
||||||
|
|
||||||
free(handle);
|
wl_keyboard_destroy(handle->wayland.keyboard);
|
||||||
|
wl_pointer_destroy(handle->wayland.pointer);
|
||||||
|
|
||||||
|
wl_flush(handle);
|
||||||
|
|
||||||
|
// free(handle);
|
||||||
|
|
||||||
if(currentlyHeldWidget == handle) {
|
if(currentlyHeldWidget == handle) {
|
||||||
currentlyHeldWidget = NULL;
|
currentlyHeldWidget = NULL;
|
||||||
|
|
@ -2252,6 +2259,7 @@ static int MwLLPendingImpl(MwLL handle) {
|
||||||
if(handle->wayland.dbus_conn) {
|
if(handle->wayland.dbus_conn) {
|
||||||
detect_dark_theme(handle);
|
detect_dark_theme(handle);
|
||||||
handle->wayland.dark_theme_detection = MwFALSE;
|
handle->wayland.dark_theme_detection = MwFALSE;
|
||||||
|
MwLLDispatch(handle, draw, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue