That's how it should be done. Check if the property is available before trying to set it. It's GNOME, which is crashing, not the Xserver, right?