gtk/gdk/x11
Carlos Garnacho c24358cfbc gdk/x11: Clear all data in GdkSurfaceX11 finalization
Currently, the GdkSurfaceX11 implementation relies that the upper
layers hid the surface before destruction, and that no
GdkSurfaceClass.compute_resize happened between them. If these
circumstances happened, there would be a compute_size timeout left
dangling after the surface got destroyed, poking at incorrect data
later on. Something that looks like this was reported in the
recent mutter-x11-frames "SSD frames server":

    mutter-x11-frames:423016): GLib-GObject-WARNING **: 19:41:16.869: invalid unclassed pointer in cast to 'GtkWindow'

    Thread 1 "mutter-x11-fram" received signal SIGTRAP, Trace/breakpoint trap.
    g_logv (log_domain=0x7ffff7f7c4f8 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=<optimized out>) at ../../../glib/gmessages.c:1433
    1433	../../../glib/gmessages.c: No such file or directory.
    (gdb) bt
    #0  g_logv (log_domain=0x7ffff7f7c4f8 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=<optimized out>) at ../../../glib/gmessages.c:1433
    #1  0x00007ffff73470ff in g_log (log_domain=log_domain@entry=0x7ffff7f7c4f8 "GLib-GObject", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x7ffff7f84da8 "invalid unclassed pointer in cast to '%s'")
        at ../../../glib/gmessages.c:1471
    #2  0x00007ffff7f72892 in g_type_check_instance_cast (type_instance=type_instance@entry=0x5555558e04b0, iface_type=<optimized out>) at ../../../gobject/gtype.c:4144
    #3  0x00007ffff791e77d in toplevel_compute_size (toplevel=<optimized out>, size=0x7fffffffe170, widget=0x5555558e04b0) at ../../../gtk/gtkwindow.c:4227
    #4  0x00007ffff7f4f3b0 in g_closure_invoke (closure=0x555555898cc0, return_value=return_value@entry=0x0, n_param_values=2, param_values=param_values@entry=0x7fffffffdeb0, invocation_hint=invocation_hint@entry=0x7fffffffde30)
        at ../../../gobject/gclosure.c:832
    #5  0x00007ffff7f62076 in signal_emit_unlocked_R
        (node=node@entry=0x55555588feb0, detail=detail@entry=0, instance=instance@entry=0x55555560e990, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffdeb0)
        at ../../../gobject/gsignal.c:3796
    #6  0x00007ffff7f68bf5 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffe050) at ../../../gobject/gsignal.c:3549
    #7  0x00007ffff7f68dbf in <emit signal ??? on instance 0x55555560e990 [GdkX11Toplevel]> (instance=<optimized out>, signal_id=<optimized out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3606
    #8  0x00007ffff7a8de96 in gdk_toplevel_notify_compute_size (toplevel=<optimized out>, size=size@entry=0x7fffffffe170) at ../../../gdk/gdktoplevel.c:112
    #9  0x00007ffff7a4b15a in compute_toplevel_size (surface=surface@entry=0x55555560e990 [GdkX11Toplevel], update_geometry=update_geometry@entry=1, width=width@entry=0x7fffffffe220, height=height@entry=0x7fffffffe224)
        at ../../../gdk/x11/gdksurface-x11.c:281
    #10 0x00007ffff7a4c3b2 in compute_size_idle (user_data=0x55555560e990) at ../../../gdk/x11/gdksurface-x11.c:356
    #11 0x00007ffff733f67f in g_main_dispatch (context=0x55555563f6e0) at ../../../glib/gmain.c:3444
    #12 g_main_context_dispatch (context=context@entry=0x55555563f6e0) at ../../../glib/gmain.c:4162
    #13 0x00007ffff733fa38 in g_main_context_iterate (context=0x55555563f6e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4238
    #14 0x00007ffff733fcef in g_main_loop_run (loop=loop@entry=0x5555560874a0) at ../../../glib/gmain.c:4438
    #15 0x0000555555557de0 in main (argc=<optimized out>, argv=<optimized out>) at ../src/frames/main.c:68

It perhaps makes sense to warn in these situations, but either way
it sounds like gdk_surface_x11_finalize() could enforce the correct
behavior by ensuring there is no dangling timeouts/data. This commit
does that.
2022-12-07 13:16:36 +01:00
..
gdkapplaunchcontext-x11.c Drop gdkintl.h 2022-09-23 23:33:42 -04:00
gdkasync.c Rename gdk-private.h to gdkprivate.h 2022-09-23 23:23:27 -04:00
gdkasync.h
gdkcairocontext-x11.c gdk: hdr => high depth 2021-10-06 22:50:07 +02:00
gdkcairocontext-x11.h
gdkclipboard-x11.c Drop gdkintl.h 2022-09-23 23:33:42 -04:00
gdkclipboard-x11.h
gdkcursor-x11.c X11: Provide settings in logical pixels 2022-11-01 13:09:28 +01:00
gdkdevice-xi2-private.h Move private GdkX11 symbols out of a public header 2020-12-15 13:46:50 +00:00
gdkdevice-xi2.c Drop gdkintl.h 2022-09-23 23:33:42 -04:00
gdkdevicemanager-x11.c x11: Use the new debug macros 2022-09-23 18:11:48 -04:00
gdkdevicemanager-xi2.c Merge branch 'forward-port-mr-991-to-gtk4-2' into 'main' 2022-10-17 19:20:08 +00:00
gdkdevicemanagerprivate-core.h
gdkdisplay-x11.c gdk: Rename GDK_SURFACE_TEMP 2022-11-17 22:49:56 -05:00
gdkdisplay-x11.h egl: Move extension checks to GdkDisplay 2021-10-06 03:44:36 +02:00
gdkdrag-x11.c gdk: Rename GDK_SURFACE_TEMP 2022-11-17 22:49:56 -05:00
gdkdrop-x11.c Drop gdkintl.h 2022-09-23 23:33:42 -04:00
gdkeventsource.c x11: Don't include gdkinternals.h 2021-09-24 22:50:29 +02:00
gdkeventsource.h
gdkeventtranslator.c
gdkeventtranslator.h x11: Don't include gdkinternals.h 2021-09-24 22:50:29 +02:00
gdkglcontext-egl.c Drop gdkintl.h 2022-09-23 23:33:42 -04:00
gdkglcontext-glx.c GLX: Add extra glXMakeContextCurrent () call to work around a DRI issue 2022-12-02 14:20:43 +01:00
gdkglcontext-x11.c Drop gdkintl.h 2022-09-23 23:33:42 -04:00
gdkglcontext-x11.h egl: Move EGLSurface handling to GdkSurface 2021-10-06 03:44:35 +02:00
gdkkeys-x11.c Don't emit ::notify from a getter 2022-11-26 21:53:33 -05:00
gdkkeys-x11.h
gdkmain-x11.c Drop gdkintl.h 2022-09-23 23:33:42 -04:00
gdkmonitor-x11.c gdk: Clean up docs syntax 2021-05-22 17:25:26 -04:00
gdkmonitor-x11.h
gdkprivate-x11.h gdk/x11: Implement XI2.4 touchpad gesture support 2021-09-27 23:19:33 +03:00
gdkproperty-x11.c x11: Don't include gdkinternals.h 2021-09-24 22:50:29 +02:00
gdkscreen-x11.c x11: Trap errors happening when getting output properties 2022-05-02 17:28:36 +02:00
gdkscreen-x11.h x11: Remove GdkVisual 2021-07-22 16:06:06 +02:00
gdkselection-x11.c gdk: Clean up docs syntax 2021-05-22 17:25:26 -04:00
gdkselectioninputstream-x11.c Drop gdkintl.h 2022-09-23 23:33:42 -04:00
gdkselectioninputstream-x11.h
gdkselectionoutputstream-x11.c Drop gdkintl.h 2022-09-23 23:33:42 -04:00
gdkselectionoutputstream-x11.h
gdksettings.c
gdksurface-x11.c gdk/x11: Clear all data in GdkSurfaceX11 finalization 2022-12-07 13:16:36 +01:00
gdksurface-x11.h egl: Move EGLSurface handling to GdkSurface 2021-10-06 03:44:35 +02:00
gdktextlistconverter-x11.c Drop gdkintl.h 2022-09-23 23:33:42 -04:00
gdktextlistconverter-x11.h
gdkvulkancontext-x11.c x11: Don't include gdkinternals.h 2021-09-24 22:50:29 +02:00
gdkvulkancontext-x11.h
gdkx11applaunchcontext.h
gdkx11device-xi2.h Move private GdkX11 symbols out of a public header 2020-12-15 13:46:50 +00:00
gdkx11device.h
gdkx11devicemanager-xi2.h
gdkx11devicemanager.h
gdkx11display.h gdk: Clean up docs syntax 2021-05-22 17:25:26 -04:00
gdkx11dnd.h
gdkx11glcontext.h x11: Add EGLDisplay getter 2021-05-11 12:42:16 +01:00
gdkx11monitor.h
gdkx11property.h
gdkx11screen.h
gdkx11selection.h
gdkx11surface.h gdk: Clean up docs syntax 2021-05-22 17:25:26 -04:00
gdkx11utils.h gdk: Clean up docs syntax 2021-05-22 17:25:26 -04:00
gdkx-autocleanups.h
gdkx.h
gdkxftdefaults.c Rename gdkdebug.h to gdkdebugprivate.h 2022-09-23 23:12:01 -04:00
gdkxid.c Documentation fixes 2021-05-20 19:17:49 -04:00
meson.build x11: Remove GdkVisual 2021-07-22 16:06:06 +02:00
MwmUtil.h
xsettings-client.c X11: Provide settings in logical pixels 2022-11-01 13:09:28 +01:00
xsettings-client.h