electron/electron

Crash when clicking notification (GNOME3)

Closed this issue · 20 comments

When receiving a notification electron crashes with:

(electron:8526): libnotify-CRITICAL **: notify_notification_close: assertion 'NOTIFY_IS_NOTIFICATION (notification)' failed
[8526:0721/170311:ERROR:browser_main_loop.cc(219)] GLib-GObject: invalid uninstantiatable type '(null)' in cast to 'GObject'
[8526:0721/170311:ERROR:browser_main_loop.cc(219)] GLib-GObject: g_object_get_data: assertion 'G_IS_OBJECT (object)' failed

I'm not sure about other environments, but it happens while using GNOME3.

Some more info:

It only happens when clicking the notification in GNOME3. Probably Gnome tries to give focus to the window and Electron somehow doesn't know what to respond.

Still occurs in 0.30.4:

(electron:24449): libnotify-CRITICAL **: notify_notification_close: assertion 'NOTIFY_IS_NOTIFICATION (notification)' failed
[24449:0813/165808:ERROR:browser_main_loop.cc(219)] GLib-GObject: invalid uninstantiatable type '-g-type-private--GTypeFlags' in cast to 'GObject'
[24449:0813/165808:ERROR:browser_main_loop.cc(219)] GLib-GObject: g_object_get_data: assertion 'G_IS_OBJECT (object)' failed
Failed to get crash dump id.

Which Linux distribution are you using? I tested on Ubuntu 14.04 with GNOME 3.

@zcbenz Ubuntu uses its own magic notifier that isn't what GNOME 3 Official uses, gotta try latest Fedora

I'm using fedora 22, should be gnome 3.16.
On Aug 13, 2015 9:06 PM, "Paul Betts" notifications@github.com wrote:

@zcbenz https://github.com/zcbenz Ubuntu uses its own magic notifier
that isn't what GNOME 3 Official uses, gotta try latest Fedora


Reply to this email directly or view it on GitHub
#2294 (comment).

Same problem in KDE

I'm unable to reproduce on Fedora 22 with GNOME 3 for v0.33.4, can you try if it still happens to on v0.33.4?

Closing until more information is provided.

I am no longer running GNOME 3, but on KDE with Fedora 23, I still have the same issue. Odd you can't reproduce it.

var app = require('app');  // Module to control application life.
var BrowserWindow = require('browser-window');  // Module to create native browser window.
var proc = require('child_process');

// Initial vars
url = 'https://web.whatsapp.com';
domain = url.replace(/https?:\/\/(\w+\.)?(\w+)\.(\w+)\/?.*/, "$2.$3");


// Report crashes to our server.
require('crash-reporter').start();

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is GCed.
var mainWindow = null;

// Quit when all windows are closed.
app.on('window-all-closed', function() {
  // On OS X it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform != 'darwin') {
    app.quit();
  }
});

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
  // Create the browser window.
  mainWindow = new BrowserWindow({width: 1024, height: 768,
    "node-integration": false,
    "icon": "/home/mark/.local/share/webapps/WhatsApp/WhatsApp.png",
    "auto-hide-menu-bar": true});

  // and load the index.html of the app.
  // mainWindow.loadUrl('file://' + __dirname + '/index.html');
  mainWindow.loadUrl(url, {'userAgent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'});

  // Emitted when the window is closed.
  mainWindow.on('closed', function() {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null;
  });

  mainWindow.webContents.on('new-window', function(event, url, frameName, disposition) {
    outDomain = url.replace(/https?:\/\/(\w+\.)?(\w+)\.(\w+)\/?.*/, "$2.$3");
    if (domain !== outDomain) {
      proc.exec("xdg-open " + url);
      event.preventDefault();
    }

  });

  mainWindow.webContents.on('context-menu', function(event) {
    alert('haha')
  })
});
{
  "name": "WhatsApp",
  "version": "0.1.0",
  "main": "main.js",
  "devDependencies": {
    "electron-prebuilt": ""
  },
  "dependencies": {
  }
}

I've been seeing the same issue with Electron 0.35.1 on GNOME 3.16.4 (Ubuntu 15.10).

It crashes when clicking on a notification created by electron, but not necessarily one that points to electron, if that's useful at all. If you cause an electron window to open, but it doesn't have focus, gnome will make a notification saying "[app] is ready", and clicking on that behaves as it should.

I'm unsure if that's helpful at all, I don't know how these notifications work exactly.

Same issue for me. Using Cinnamon on Mint. Clicking on the notification causes the app to crash and close. even when the app is in focus on the screen.

I'm still seeing this with Electron 0.35.2 as well. A similar issue with Windows was fixed in this release, but apparently not GNOME.

Me too, Ubuntu 15.10 and the latest version of Electron. Please fix!

The biggest trouble for me is I never succeeded to reproduce this issue, I have 4 Linux distributions installed and each with various DEs, every one of them works fine.

I#m actually wrapping webpages in Electron with https://www.npmjs.com/package/nativefier. Possibly you can generate one with this and try?

I'm on Ubuntu GNOME, if that makes a difference.

Can you delete the libnotify.so file in the Electron distribution and see whether it solves the crash?

Where is the 'electron distribution?' I'm using the Discord client; https://github.com/XNBlank/discord-linux/releases

Same issue on Xubuntu 14.04