GNOME Bugzilla – Bug 651225
Trying to load an unknown gsetting schemas crash gnome-shell
Last modified: 2011-05-27 15:10:16 UTC
When you try to load an unknown gsetting schemas within an extension, the entire gnome shell crash and you can't even close the session. You have no other alternative than rebooting, To reproduce the bug just put this in any extension code in gnome-shell, but i fear that this is reproductible in any gnome shell code place: let settings = new Gio.Settings({ schema: 'org.gnome.fantasy.schemas' });
This is a known issue with the gsettings API.
This can also be considered as a bug in the Shell: if you install a broken extension that makes it crash, you should always get something working in the end. Either fallback mode, or a Shell with extensions disabled, but not *nothing*. The behavior of GSettings with missing schemas is sane: if we don't have them, what can the program possibly do? If programmers can't rely on the fact that the schema is always present, they'll need to hardcode fallback values and ugly code paths, which is a waste of time. The only improvement I can think of is to add a g_settings_new_do_not_abort() function that would allow programs loading extensions to stop loading the extension in case of missing schema instead of aborting. But that supposes more complexity, and there's no guarantee extension authors would correclty use it.
gsettings should not abort. an exeption, or an error should be emited and you should let the programmer exit the program accordingly. You can't make the whole shell abort because it's the sane thing to do! it's nonsense. The programmer can deal with this in a clean way, even alerting the user of a faulty installation. But aborting is not the way to go...
This is working as designed.
Then designers should review their copies. Just to be clear. You can't make the developper desktop blow away everytime he make a small mistake. You can't make the user desktop go away every time he installs something badly. I hope this is not going to be a 'won't fix' , 'your desktop is crashing by design'. The design is clearly bad. please reconsider this, you can't let all the gnome 3 destop abort because you made a design decision you think is sane. This is not sane, it's lame. I just took a look in gsettings code source, and i see nothing that prevents it from returning a null pointer on failure. althought retrieving an optional error should be allowed for logging purposes.
(In reply to comment #2) > The only improvement I can think of is to add a g_settings_new_do_not_abort() > function that would allow programs loading extensions to stop loading the > extension in case of missing schema instead of aborting. But that supposes more > complexity, and there's no guarantee extension authors would correclty use it. The extension loader could provide such a function by having it call g_settings_list_schemas() first and seeing if the requested schema was included there.
oops *** This bug has been marked as a duplicate of bug 651240 ***
(In reply to comment #4) > This is working as designed. Well, it might be working as designed from C, but the fact that accessing a not-present schema from an interpreted language is an abort not an exception is a disaster. We need to fix that.