mirror of
https://github.com/fltk/fltk.git
synced 2026-05-30 04:55:29 +08:00
Fix fltk.coredev: mandelbrot demo segfault under Wayland
This commit is contained in:
@@ -212,13 +212,13 @@ void Fl_Wayland_Graphics_Driver::cairo_init(struct Fl_Wayland_Graphics_Driver::d
|
|||||||
static void do_buffer_release(
|
static void do_buffer_release(
|
||||||
struct Fl_Wayland_Graphics_Driver::wld_buffer *buffer) {
|
struct Fl_Wayland_Graphics_Driver::wld_buffer *buffer) {
|
||||||
struct wl_shm_pool *my_pool = buffer->shm_pool;
|
struct wl_shm_pool *my_pool = buffer->shm_pool;
|
||||||
|
if (buffer->wl_buffer) {
|
||||||
struct Fl_Wayland_Graphics_Driver::wld_shm_pool_data *pool_data =
|
struct Fl_Wayland_Graphics_Driver::wld_shm_pool_data *pool_data =
|
||||||
(struct Fl_Wayland_Graphics_Driver::wld_shm_pool_data*)
|
(struct Fl_Wayland_Graphics_Driver::wld_shm_pool_data*)
|
||||||
wl_shm_pool_get_user_data(my_pool);
|
wl_shm_pool_get_user_data(my_pool);
|
||||||
wl_buffer_destroy(buffer->wl_buffer);
|
wl_buffer_destroy(buffer->wl_buffer);
|
||||||
// remove wld_buffer from list of pool's buffers
|
// remove wld_buffer from list of pool's buffers
|
||||||
wl_list_remove(&buffer->link);
|
wl_list_remove(&buffer->link);
|
||||||
free(buffer);
|
|
||||||
if (wl_list_empty(&pool_data->buffers) && my_pool != pool) {
|
if (wl_list_empty(&pool_data->buffers) && my_pool != pool) {
|
||||||
// all buffers from pool are gone
|
// all buffers from pool are gone
|
||||||
wl_shm_pool_destroy(my_pool);
|
wl_shm_pool_destroy(my_pool);
|
||||||
@@ -227,6 +227,8 @@ static void do_buffer_release(
|
|||||||
free(pool_data);
|
free(pool_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Fl_Wayland_Graphics_Driver::buffer_release(struct wld_window *window)
|
void Fl_Wayland_Graphics_Driver::buffer_release(struct wld_window *window)
|
||||||
|
|||||||
Reference in New Issue
Block a user