Workaround for crashing Electron/Atom applications!

A few days ago  all my Electron (Atom Shell) apps started crashing on my Ubuntu 17.10  (Artful Aardvark) machine: Skype, Discord, Slack…  and each stack trace looks very much like this:

#0 0x0000000003419062 in ()
#1 0x0000000003f96086 in __start_google_malloc ()
#2 0x00000000034b9dc5 in calloc ()
#3 0x00007ffff20dc5d1 in g_malloc0 () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x00007ffff4afc4c9 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#5 0x00007ffff4b01855 in g_type_register_static () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#6 0x00007ffff4b01af5 in g_type_register_static_simple () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#7 0x00007ffff5c93f24 in gdk_display_manager_get_type () at /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#8 0x00007ffff5c93f69 in gdk_display_manager_get () at /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#9 0x00007ffff6070954 in () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#10 0x00007ffff6056f28 in () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#11 0x00007ffff20e2fdf in g_option_context_parse () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#12 0x00007ffff6057538 in gtk_parse_args () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#13 0x00007ffff60575b9 in gtk_init () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#14 0x0000000001049626 in ()
#15 0x000000000104f1e7 in ()
#16 0x0000000001051656 in ()
#17 0x0000000003f6897b in brightray::BrowserMainParts::PreEarlyInitialization() ()
#18 0x0000000003e01169 in atom::AtomBrowserMainParts::PreEarlyInitialization() ()
#19 0x00000000015f6cf4 in ()

I don’t really know what’s on foot here, but Google led me to the GTK2_RC_FILES environment variable.

If I set this to empty, all these applications start properly!

Example starting Skype, note the space after the equals sign:

$ GTK2_RC_FILES= skypeforlinux

or

$ export GTK2_RC_FILES=
$ skypeforlinux

Can someone explain this error and what a proper fix would look like?

Update: Setting the XDG_CONFIG_DIRS environment variable to empty also works as a workaround!