Bug 832799

Summary: segfault on snippet involving Gdk.Screen().get_n_monitors()
Product: [Fedora] Fedora Reporter: Alon Levy <alevy>
Component: pygobject3Assignee: John Keck <jkeck>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: dblechte, icq, jkeck, s.feltman
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-01 01:15:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alon Levy 2012-06-17 13:52:42 UTC
Description of problem:
pyobject3 fails with the test program below on gdk_screen_get_n_monitors.

Version-Release number of selected component (if applicable):
pygobject3-3.2.0-1.fc17.x86_64

How reproducible:
100%

Steps to Reproduce:
$ python -c "from gi.repository import Gdk; Gdk.init([]); s=Gdk.Screen(); print s.get_n_monitors()"

Note: same results with or without the Gdk.init call, or if using Gdk.init(sys.argv)

Actual results:
$ python -c "from gi.repository import Gdk; Gdk.init([]); s=Gdk.Screen(); print s.get_n_monitors()"
Segmentation fault (core dumped)

Expected results:
print 2 like example below with pygtk.

Additional info:
The equivalent pygtk works:

$ python -c "import gtk; s=gtk.gdk.Screen(); print s.get_n_monitors()"
[cut some warnings]
2

Also the equivalent c code works:
#include <stdio.h>
#include <gdk/gdk.h>

int main(int argc, char **argv)
{
    GdkScreen *screen;

    gdk_init(&argc, &argv);

    screen = gdk_screen_get_default();

    printf("%d\n", gdk_screen_get_n_monitors(screen));
    return 0;
}

And so does the equivalent 

Stack trace:
#0  0x0000000000000000 in ?? ()
#1  0x0000003b07e05e90 in ffi_call_unix64 () at ../src/x86/unix64.S:75
#2  0x0000003b07e058a0 in ffi_call (cif=cif@entry=0x7fffffffd120, fn=fn@entry=
    0x31be028bf0 <gdk_screen_get_n_monitors>, rvalue=rvalue@entry=0x7fffffffd100, avalue=avalue@entry=
    0x7fffffffd040) at ../src/x86/ffi64.c:486
#3  0x0000003b23c0a584 in g_callable_info_invoke (info=info@entry=0x796630, function=0x31be028bf0, 
    in_args=in_args@entry=0x74b850, n_in_args=n_in_args@entry=1, out_args=out_args@entry=0x0, 
    n_out_args=n_out_args@entry=0, return_value=return_value@entry=0x7fffffffd2e0, 
    is_method=is_method@entry=1, throws=0, error=error@entry=0x7fffffffd298)
    at girepository/gicallableinfo.c:610
#4  0x0000003b23c0b8eb in g_function_info_invoke (info=0x796630, in_args=0x74b850, n_in_args=1, 
    out_args=0x0, n_out_args=0, return_value=return_value@entry=0x7fffffffd2e0, error=error@entry=
    0x7fffffffd298) at girepository/gifunctioninfo.c:274
#5  0x00007ffff1846c41 in _invoke_callable (callable_info=<optimized out>, cache=0x808d80, state=
    0x7fffffffd2a0) at pygi-invoke.c:52
#6  _wrap_g_callable_info_invoke (self=0x7ffff003c518, py_args=<optimized out>, kwargs=<optimized out>)
    at pygi-invoke.c:633
#7  0x0000003b18edc1e0 in ext_do_call (nk=0, na=<optimized out>, flags=<optimized out>, pp_stack=
    0x7fffffffd4f8, func=<built-in method invoke of gi.FunctionInfo object at remote 0x7ffff003c518>)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:4408
#8  PyEval_EvalFrameEx (f=f@entry=
    Frame 0x7e62a0, for file /usr/lib64/python2.7/site-packages/gi/types.py, line 43, in function (args=(<Screen at remote 0x7ffff0532f50>,), kwargs={}), throwflag=throwflag@entry=0)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:2779
#9  0x0000003b18eddb2f in PyEval_EvalCodeEx (co=<optimized out>, globals=<optimized out>, 
    locals=locals@entry=0x0, args=<optimized out>, argcount=argcount@entry=1, kws=0x6d16e0, kwcount=0, 
    defs=0x0, defcount=0, closure=(<cell at remote 0x7ffff003b718>,))
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:3330
#10 0x0000003b18edc123 in fast_function (nk=<optimized out>, na=1, n=<optimized out>, pp_stack=
    0x7fffffffd7a8, func=<function at remote 0x7ffff003d500>)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:4194
#11 call_function (oparg=<optimized out>, pp_stack=0x7fffffffd7a8)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:4119
#12 PyEval_EvalFrameEx (f=f@entry=Frame 0x6d1560, for file <string>, line 1, in <module> (), 
    throwflag=throwflag@entry=0) at /usr/src/debug/Python-2.7.3/Python/ceval.c:2740
#13 0x0000003b18eddb2f in PyEval_EvalCodeEx (co=co@entry=0x7ffff7efe9b0, globals=globals@entry=
    {'__builtins__': <module at remote 0x7ffff7f7aad0>, '__package__': None, 'sys': <module at remote 0x7ffff7f7ab78>, 's': <Screen at remote 0x7ffff0532f50>, '__name__': '__main__', 'Gdk': <DynamicModule(_overrides_module=<module at remote 0x7ffff052eb40>, _namespace='Gdk', _introspection_module=<IntrospectionModule(_namespace='Gdk', DragContext=<GObjectMeta(__module__='gi.repository.Gdk', get_actions=<function at remote 0x7ffff0030de8>, get_device=<function at remote 0x7ffff0030ed8>, get_source_window=<function at remote 0x7ffff003a0c8>, list_targets=<function at remote 0x7ffff003a1b8>, get_dest_window=<function at remote 0x7ffff0030e60>, set_device=<function at remote 0x7ffff003a230>, get_selected_action=<function at remote 0x7ffff003a050>, get_protocol=<function at remote 0x7ffff0030f50>, get_suggested_action=<function at remote 0x7ffff003a140>, __gtype__=<gobject.GType at remote 0x7ffff7f3a648>, __info__=<ObjectInfo at remote 0x7ffff0037dd0>, __doc__=None) at remote 0x7e3b00>, EventSetting=<StructMeta(send_e...(truncated), locals=locals@entry=
    {'__builtins__': <module at remote 0x7ffff7f7aad0>, '__package__': None, 'sys': <module at remote 0x7ffff7f7ab78>, 's': <Screen at remote 0x7ffff0532f50>, '__name__': '__main__', 'Gdk': <DynamicModule(_overrides_module=<module at remote 0x7ffff052eb40>, _namespace='Gdk', _introspection_module=<IntrospectionModule(_namespace='Gdk', DragContext=<GObjectMeta(__module__='gi.repository.Gdk', get_actions=<function at remote 0x7ffff0030de8>, get_device=<function at remote 0x7ffff0030ed8>, get_source_window=<function a---Type <return> to continue, or q <return> to quit---

Comment 2 Fedora End Of Life 2013-07-03 22:58:55 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Simon Feltman 2013-07-04 00:13:45 UTC
Note you are probably running into: https://bugzilla.gnome.org/show_bug.cgi?id=675581

Rather than using "Gdk.Screen()", use "Gdk.Screen.get_default()" since it is a singleton.

Comment 4 Fedora End Of Life 2013-08-01 01:15:51 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.