python python Gtk.Builder.connect_signals() seg faults

Terrence Kovacs Terrence.Kovacs@dartmouth.edu
Thu Mar 24 13:58:00 GMT 2016


It seems there is a bug in the cygwin version of the python Gtk.Builder.connect_signals().
Calling this function seg faults.  I have been unable to determine the root cause but I have found a work around.
The issue can be reproduced using the demo program from:

http://python-gtk-3-tutorial.readthedocs.org/en/latest/builder.html

Also important is that this demo runs w/o problem on an older (Feb 2015) cygwin installation.
This is for python version 2.7 and gtk3 running on windows 7.  Attached is the cygcheck from the problem system.

The demo program:
--------------------------------
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

class Handler:
    def onDeleteWindow(self, *args):
        Gtk.main_quit(*args)

    def onButtonPressed(self, button):
        print("Hello World!")

builder = Gtk.Builder()
builder.add_from_file("builder_example.glade")
builder.connect_signals(Handler())

window = builder.get_object("window1")
window.show_all()

Gtk.main()
-----------------------------------

builder_example_glade:
-----------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <!-- interface-requires gtk+ 3.0 -->
  <object class="GtkWindow" id="window1">
    <property name="can_focus">False</property>
    <signal name="delete-event" handler="onDeleteWindow" swapped="no"/>
    <child>
      <object class="GtkButton" id="button1">
        <property name="label" translatable="yes">button</property>
        <property name="use_action_appearance">False</property>
        <property name="visible">True</property>
        <property name="can_focus">True</property>
        <property name="receives_default">True</property>
        <property name="use_action_appearance">False</property>
        <signal name="pressed" handler="onButtonPressed" swapped="no"/>
      </object>
    </child>
  </object>
</interface>
--------------------------------------

my work around:
--------------------------------------
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

class Handler:
    def onDeleteWindow(self, *args):
        Gtk.main_quit(*args)

    def onButtonPressed(self, button):
        print("Hello World!")

builder = Gtk.Builder()
builder.add_from_file("builder_example.glade")
window = builder.get_object("window1")
handler = Handler()
window.connect("delete-event", handler.onDeleteWindow)

button = builder.get_object("button1")
button.connect("pressed", handler.onButtonPressed)

window.show_all()

Gtk.main()
--------------------------------------

 
 Terrence Kovacs
 Research Systems Engineer
 Physics and Astronomy Department
 Dartmouth College
 Wilder 341, 603-646-9303
     
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 33697 bytes
Desc: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20160324/43132762/attachment.obj>
-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list