GdkSurface - Don't call unimplemented NULL set_startup_id() vfunc on Win32
authorSebastian Dröge <sebastian@centricular.com>
Tue, 7 May 2019 06:53:51 +0000 (09:53 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 7 May 2019 18:38:46 +0000 (21:38 +0300)
GdkSurface::set_startup_id() is NULL on Win32 and would cause a segfault
if called.

While the documentation of the main caller of set_startup_id(),
gtk_window_set_startup_id(), mentions that it's not implemented on
Windows it can still be automatically called via Glade and simply doing
nothing on Win32 is going to be less disruptive than a segfault.

gdk/gdksurface.c

index 589a17dfa7dd6b667fd75aeaa8f38170d4a50edb..7e95e6a74c72d88deb95a0ac96783c0fde750cd5 100644 (file)
@@ -4202,7 +4202,10 @@ void
 gdk_surface_set_startup_id (GdkSurface   *surface,
                             const gchar *startup_id)
 {
-  GDK_SURFACE_IMPL_GET_CLASS (surface->impl)->set_startup_id (surface, startup_id);
+  GdkSurfaceImplClass *klass = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
+
+  if (klass->set_startup_id)
+    klass->set_startup_id (surface, startup_id);
 }
 
 /**