Skip to contentSkip to conversation

Fixed the "build again" hang

PATCH In review Lianhao Lu 2 participants 3 messages Jun 10, 2011

lore
Share & tools
lore

Lianhao Lu

author
#0 lore raw

cover Fixed the "build again" hang

NOTE: This series of patch should be applied to the branch contrib/image-creator.

Modified hob to use the correct pygtk treading model "gobject.threads_init()". See http://faq.pygtk.org/index.py?req=show&file=faq20.006.htp for details.

This model only allows the main thread to touch the GUI (gtk) part, what is exactly the hob does.

The following changes since commit 116c075301878dbd769b7f39ec24381ac686502c:
Liping Ke (1):
Make bitbake server type configurable(xmlrpc,none)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib llu/build_again
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=llu/build_again

Lianhao Lu (1):
bitbake/hob: Fixed the "build again" hang.

 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    3 +++
 bitbake/lib/bb/ui/hob.py                    |    5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)
author
#1 lore raw

PATCH 1/1 bitbake/hob: Fixed the "build again" hang.

Using gobject.threads_init() instead of gtk.gdk.threads_init(). These two modes are conflict to each other. Using gobject.threads_init() allows only the main thread to touch GUI(gtk) part.

---
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    3 +++
 bitbake/lib/bb/ui/hob.py                    |    5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)
bitbake/lib/bb/ui/crumbs/hobeventhandler.py +3 -0
index c474491..a11e6d4 100644
@@ -134,6 +134,9 @@ class HobHandler(gobject.GObject):
         self.building = True
         self.server.runCommand(["buildTargets", targets, "build"])
 
+    def notify_building_state(self, building):
+        self.building = building
+
     def cancel_build(self):
         # Note: this may not be the right way to stop an in-progress build
         self.server.runCommand(["stateStop"])
bitbake/lib/bb/ui/hob.py +3 -2
index ab6022b..46fb563 100644
@@ -63,9 +63,11 @@ class MainWindow (gtk.Window):
 
     def running_build_failed_cb(self, running_build):
         # FIXME: handle this
+        self.handler.notify_building_state(False)
         return
 
     def running_build_succeeded_cb(self, running_build):
+        self.handler.notify_building_state(False)
         label = gtk.Label("Build completed, start another build?")
         dialog = gtk.Dialog("Build complete",
                             self,
@@ -76,7 +78,7 @@ class MainWindow (gtk.Window):
         label.show()
         response = dialog.run()
         dialog.destroy()
-        if not response == gtk.RESPONSE_YES:
+        if response == gtk.RESPONSE_YES:
             self.model.reset() # NOTE: really?
             self.nb.set_current_page(0)
         return
@@ -555,7 +557,6 @@ class MainWindow (gtk.Window):
 
 def main (server, eventHandler):
     gobject.threads_init()
-    gtk.gdk.threads_init()
 
     taskmodel = TaskListModel()
     handler = HobHandler(taskmodel, server)
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [IMAGE_CREATOR 1/1] bitbake/hob: Fixed the "build again" hang.

Quoted 3 lines · Lianhao Lu

Using gobject.threads_init() instead of gtk.gdk.threads_init(). These two modes are conflict to each other. Using gobject.threads_init() allows only the main thread to touch GUI(gtk) part.

Great catch! Thanks for the patch.

I'm going to merge just the hunk which drops the gtk.gdk.threads_init() (with your SOB, hope that's OK?) into the image-creator branch as I have changes with similar intent to the other hunks in my WIP tree (josh/hob).

Thanks again,
Joshua

Quoted 54 lines
---
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    3 +++
 bitbake/lib/bb/ui/hob.py                    |    5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)
bitbake/lib/bb/ui/crumbs/hobeventhandler.py +3 -0
index c474491..a11e6d4 100644
@@ -134,6 +134,9 @@ class HobHandler(gobject.GObject):
         self.building = True
         self.server.runCommand(["buildTargets", targets, "build"])
 
+    def notify_building_state(self, building):
+        self.building = building
+
     def cancel_build(self):
         # Note: this may not be the right way to stop an in-progress build
         self.server.runCommand(["stateStop"])
bitbake/lib/bb/ui/hob.py +3 -2
index ab6022b..46fb563 100644
@@ -63,9 +63,11 @@ class MainWindow (gtk.Window):
 
     def running_build_failed_cb(self, running_build):
         # FIXME: handle this
+        self.handler.notify_building_state(False)
         return
 
     def running_build_succeeded_cb(self, running_build):
+        self.handler.notify_building_state(False)
         label = gtk.Label("Build completed, start another build?")
         dialog = gtk.Dialog("Build complete",
                             self,
@@ -76,7 +78,7 @@ class MainWindow (gtk.Window):
         label.show()
         response = dialog.run()
         dialog.destroy()
-        if not response == gtk.RESPONSE_YES:
+        if response == gtk.RESPONSE_YES:
             self.model.reset() # NOTE: really?
             self.nb.set_current_page(0)
         return
@@ -555,7 +557,6 @@ class MainWindow (gtk.Window):
 
 def main (server, eventHandler):
     gobject.threads_init()
-    gtk.gdk.threads_init()
 
     taskmodel = TaskListModel()
     handler = HobHandler(taskmodel, server)
Signature · 3 lines
Joshua Lock
        Yocto Build System Monkey
        Intel Open Source Technology Centre