[polari/wip/fmuellner/warning-fixes: 6/6] application: Avoid duplicated ::prepare-shutdown emissions
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/warning-fixes: 6/6] application: Avoid duplicated ::prepare-shutdown emissions
- Date: Mon, 3 Dec 2018 20:08:03 +0000 (UTC)
commit 725a41a58710e044ce01ae8adc6e795af6989f79
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Dec 3 17:49:37 2018 +0100
application: Avoid duplicated ::prepare-shutdown emissions
Since commit 00ab02ca524 added the ability to run in the background,
the ::prepare-shutdown signal is emitted either when the main window
is closed (and the app shouldn't keep running), or when explicitly
quitting the app. But as the quit action also closes all windows, it
is possible for the signal to be emitted twice, resulting in a warning
when the telepathy client releases an additional app reference (it
doesn't hold).
Avoid this by making sure the signal handler which emits the signal
when closing the main window is disconnected from the quit action.
https://gitlab.gnome.org/GNOME/polari/merge_requests/79
src/application.js | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 18c7362..a8f9877 100644
--- a/src/application.js
+++ b/src/application.js
@@ -341,16 +341,18 @@ var Application = GObject.registerClass({
this.activate_action('start-client', null);
if (!this.active_window) {
+ if (this._windowRemovedId)
+ this.disconnect(this._windowRemovedId);
+ this._windowRemovedId = 0;
+
if (this._needsInitialSetup()) {
new InitialSetupWindow({ application: this });
this._windowRemovedId = this.connect('window-removed', () => {
- this.disconnect(this._windowRemovedId);
- this._windowRemovedId = 0;
this.activate();
});
} else {
let window = new MainWindow({ application: this });
- window.connect('destroy', () => {
+ this._windowRemovedId = this.connect('window-removed', () => {
if (this._settings.get_boolean('run-in-background'))
return;
this.emit('prepare-shutdown');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]