GNOME Bugzilla – Bug 754941
clicking on good-by button gives a error
Last modified: 2018-07-05 08:25:51 UTC
Overview: when the programe contain hello.js is run,a new window pops up,but on clicking a good-by button it gives a error. Steps To Reproduce: 1.Run a programe with a command `gjs hello.js` 2.when a new window pops up click on "good-by' button. Actual Result: (gjs:7906): Gjs-WARNING **: JS ERROR: ReferenceError: application is not defined WelcomeToTheGrid<._quit@hello.js:68 wrapper@resource:///org/gnome/gjs/modules/lang.js:169 @hello.js:75 Expected Result: There should be some result which is valid on clicking that button. Build Date & Hardware: Build 2015-09-12 on Ubuntu OS 15.04
Created attachment 311223 [details] [review] Quit function corrected and filename of gnome image corrected This attachment is patch. Quit function is corrected and filename of gnome image corrected These two issues was responsible for the cause of error.
Comment on attachment 311223 [details] [review] Quit function corrected and filename of gnome image corrected >From c033a83f2b085811000a71d8db7ec839e2b7453d Mon Sep 17 00:00:00 2001 >From: prashanttyagi <prashant.tyagi@research.iiit.ac.in> >Date: Sun, 13 Sep 2015 08:00:44 +0530 >Subject: [PATCH] Corrected gnome image Filename (.jpg to .png) Correctd > _quit() button > >--- > hello.js | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > >diff --git a/hello.js b/hello.js >index 39fe8b9..b7290e0 100755 >--- a/hello.js >+++ b/hello.js >@@ -39,7 +39,7 @@ const WelcomeToTheGrid = new Lang.Class({ > this._grid = new Gtk.Grid ({ row_spacing: 20 }); > > // Create an image >- this._image = new Gtk.Image ({ file: "gnome-image.jpg" }); >+ this._image = new Gtk.Image ({ file: "gnome-image.png" }); > > // Create a second image using a stock icon > this._icon = new Gtk.Image ({ stock: 'gtk-about' }); >@@ -49,7 +49,7 @@ const WelcomeToTheGrid = new Lang.Class({ > > // Create a button > this._button = new Gtk.Button ({ label: ".. .and good-by" }); >- this._button.connect ("clicked", Lang.bind(this, this._quit)); >+ this._button.connect ("clicked", Lang.bind(this,this._quit)); > > // Attach the images and button to the grid > this._grid.attach (this._image, 0, 0, 2, 1); >@@ -64,8 +64,8 @@ const WelcomeToTheGrid = new Lang.Class({ > this._window.show_all(); > }, > >- _quit: function() { >- application.quit(); >+ _quit: function() { >+ this.application.quit(); > } > > }); >-- >1.9.1 >
Review of attachment 311223 [details] [review]: Thanks for finding this! I think two of the lines may have been changed on accident and do not need to be part of the patch. Could you restore them to their original code and attach an updated patch? ::: hello.js @@ -50,3 +50,3 @@ // Create a button this._button = new Gtk.Button ({ label: ".. .and good-by" }); - this._button.connect ("clicked", Lang.bind(this, this._quit)); + this._button.connect ("clicked", Lang.bind(this,this._quit)); I dont think this line needs to be changed @@ +65,3 @@ }, + _quit: function() { I dont think this line needs to be changed
Created attachment 311528 [details] [review] quit function corrected and filename of image corrected
Created attachment 323328 [details] [review] autostart-app: initialize i from previous commit We weren't initializing it to 0. This commit changes the while loop to a for loop to make room for a natural place to initialize i.
Comment on attachment 323328 [details] [review] autostart-app: initialize i from previous commit Attachment 323328 [details] pushed as 97d413f - autostart-app: initialize i from previous commit
Created attachment 323329 [details] [review] util: fix bug leading to cleared child environment The code was trying to initialize the environment with g_listenv the first time it was run, but instead, ended up using a cleared environment everytime.
Comment on attachment 323329 [details] [review] util: fix bug leading to cleared child environment Attachment 323329 [details] pushed as f44db06 - util: fix bug leading to cleared child environment
sorry guys for coopting your bug, i meant to use bug 754951
As this task is in the "newcomers-tutorial" product in Bugzilla, I am closing this task as per bug 685176 comment 2.