Skip to content
  • Lubomir Rintel's avatar
    libnm: register empty NMClient and NetworkManager when loading libnm with GIR · 4d1f090a
    Lubomir Rintel authored
    Register empty "NMClient" and "NetworkManager" GIR modules as soon as libnm is
    loaded witch gnome-introspection. This prevents the real modules from being
    loaded because they would in turn load libnm-glib and abort() and crash.
    
    In particular this prevents the GNOME shell from crashing with
    libnm-glib abort and allows gracefully disabling the extensions which
    use the obsolete library.
    
    Test:
    
      $ cat test.js
      const NM = imports.gi.NM;
      print (NM.SecretAgentGetSecretsFlags.ALLOW_INTERACTION);
    
      const NMClient = imports.gi.NMClient;
      print (NMClient.SecretAgentGetSecretsFlags.ALLOW_INTERACTION);
    
    Before:
    
      $ gjs test.js
      1
    
      (gjs:16253): libnm-util-ERROR **: libnm symbols detected; Mixing libnm with libnm-util/libnm-glib is not supported
      Trace/breakpoint trap (core dumped)
      $
    
    After:
    
      $ gjs test.js
      1
      Gjs-Message: JS WARNING: [test.js 5]: reference to undefined property "SecretAgentGetSecretsFlags"
    
      (gjs:16228): Gjs-WARNING **: JS ERROR: TypeError: NMClient.SecretAgentGetSecretsFlags is undefined
      @test.js:5:1
    
      JS_EvaluateScript() failed
    4d1f090a