GNOME Bugzilla – Bug 556054
codegen: Add 'keep-refcount' handling for GBoxed arguments
Last modified: 2008-12-06 15:41:50 UTC
Steps to reproduce: #!/usr/bin/env python import gobject import pygst pygst.require('0.10') import gst print gst.version() print gst.pygst_version b = gst.Bin() s = gst.structure_from_string( 'bla' ) m1 = gst.message_new_custom( gst.MESSAGE_ANY, b, s ) m2 = gst.message_new_custom( gst.MESSAGE_ANY, b, s ) Stack trace: (0, 10, 20, 0) (0, 10, 12) (gstcrash.py:13081): GStreamer-CRITICAL **: gst_structure_set_parent_refcount: assertion `refcount == NULL' failed (gstcrash.py:13081): GStreamer-CRITICAL **: gst_structure_set_parent_refcount: assertion `refcount != NULL' failed *** glibc detected *** python: free(): invalid pointer: 0x0810aa38 *** ======= Backtrace: ========= /lib/libc.so.6[0xb7ccca00] /lib/libc.so.6(cfree+0x89)[0xb7cce6f9] /usr/lib/libglib-2.0.so.0(g_free+0x2d)[0xb793e962] /usr/lib/libglib-2.0.so.0(g_array_free+0x48)[0xb791abe0] /usr/lib/libgstreamer-0.10.so.0(gst_structure_free+0x99)[0xb7804c24] /usr/lib/libgstreamer-0.10.so.0[0xb77e82fe] /usr/lib/libgstreamer-0.10.so.0(gst_mini_object_unref+0xa4)[0xb77e890c] /usr/lib/python2.5/site-packages/gst-0.10/gst/_gst.so[0xb78bd8b9] /usr/lib/libpython2.5.so.1.0[0xb7e29e0d] /usr/lib/libpython2.5.so.1.0(PyDict_SetItem+0x76)[0xb7e2bfe0] /usr/lib/libpython2.5.so.1.0(_PyModule_Clear+0x197)[0xb7e2dcfd] /usr/lib/libpython2.5.so.1.0(PyImport_Cleanup+0x177)[0xb7e84fd6] /usr/lib/libpython2.5.so.1.0(Py_Finalize+0xd0)[0xb7e8bed7] /usr/lib/libpython2.5.so.1.0(Py_Main+0x4dc)[0xb7e95950] python(main+0x2e)[0x804861e] /lib/libc.so.6(__libc_start_main+0xdc)[0xb7c7cfdc] python[0x8048571] ======= Memory map: ======== 08048000-08049000 r-xp 00000000 08:05 330245 /usr/bin/python2.5 08049000-0804a000 r--p 00000000 08:05 330245 /usr/bin/python2.5 0804a000-0804b000 rw-p 00001000 08:05 330245 /usr/bin/python2.5 0804b000-081e7000 rw-p 0804b000 00:00 0 [heap] b7300000-b7321000 rw-p b7300000 00:00 0 b7321000-b7400000 ---p b7321000 00:00 0 b74bb000-b74f8000 r-xp 00000000 08:05 677479 /usr/lib/python2.5/site-packages/libxml2mod.so b74f8000-b74f9000 r--p 0003d000 08:05 677479 /usr/lib/python2.5/site-packages/libxml2mod.so b74f9000-b74fe000 rw-p 0003e000 08:05 677479 /usr/lib/python2.5/site-packages/libxml2mod.so b74fe000-b75e1000 rw-p b74fe000 00:00 0 b75e1000-b75ea000 r-xp 00000000 08:05 330683 /usr/lib/libgstinterfaces-0.10.so.0.14.0 b75ea000-b75eb000 r--p 00008000 08:05 330683 /usr/lib/libgstinterfaces-0.10.so.0.14.0 b75eb000-b75ec000 rw-p 00009000 08:05 330683 /usr/lib/libgstinterfaces-0.10.so.0.14.0 b75ec000-b75f8000 r-xp 00000000 08:05 561145 /usr/lib/python2.5/site-packages/gst-0.10/gst/interfaces.so b75f8000-b75f9000 r--p 0000b000 08:05 561145 /usr/lib/python2.5/site-packages/gst-0.10/gst/interfaces.so b75f9000-b75fa000 rw-p 0000c000 08:05 561145 /usr/lib/python2.5/site-packages/gst-0.10/gst/interfaces.so b75fa000-b7601000 r--s 00000000 08:05 330020 /usr/lib/gconv/gconv-modules.cache b7601000-b7642000 rw-p b7601000 00:00 0 b7642000-b764a000 r-xp 00000000 08:05 1935395 /lib/libnss_files-2.6.1.so b764a000-b764b000 r--p 00007000 08:05 1935395 /lib/libnss_files-2.6.1.so b764b000-b764c000 rw-p 00008000 08:05 1935395 /lib/libnss_files-2.6.1.so b764c000-b7654000 r-xp 00000000 08:05 1935400 /lib/libnss_nis-2.6.1.so b7654000-b7655000 r--p 00007000 08:05 1935400 /lib/libnss_nis-2.6.1.so b7655000-b7656000 rw-p 00008000 08:05 1935400 /lib/libnss_nis-2.6.1.so b7656000-b7669000 r-xp 00000000 08:05 1935399 /lib/libnsl-2.6.1.so b7669000-b766a000 r--p 00012000 08:05 1935399 /lib/libnsl-2.6.1.so b766a000-b766b000 rw-p 00013000 08:05 1935399 /lib/libnsl-2.6.1.so b766b000-b766d000 rw-p b766b000 00:00 0 b766d000-b7673000 r-xp 00000000 08:05 1935402 /lib/libnss_compat-2.6.1.so b7673000-b7674000 r--p 00005000 08:05 1935402 /lib/libnss_compat-2.6.1.so b7674000-b7675000 rw-p 00006000 08:05 1935402 /lib/libnss_compat-2.6.1.so b7675000-b7686000 r-xp 00000000 08:05 1933432 /lib/libz.so.1.2.3 b7686000-b7687000 r--p 00010000 08:05 1933432 /lib/libz.so.1.2.3 b7687000-b7688000 rw-p 00011000 08:05 1933432 /lib/libz.so.1.2.3 b7688000-b7797000 r-xp 00000000 08:05 330436 /usr/lib/libxml2.so.2.6.31 b7797000-b779b000 r--p 0010f000 08:05 330436 /usr/lib/libxml2.so.2.6.31 b779b000-b779c000 rw-p 00113000 08:05 330436 /usr/lib/libxml2.so.2.6.31 b779c000-b779d000 rw-p b779c000 00:00 0 b779d000-b77a0000 r-xp 00000000 08:05 3246539 /usr/lib/libgmodule-2.0.so.0.1400.6 b77a0000-b77a1000 rw-p 00002000 08:05 3246539 /usr/lib/libgmodule-2.0.so.0.1400.6 b77a1000-b7846000 r-xp 00000000 08:05 330652 /usr/lib/libgstreamer-0.10.so.0.17.0 b7846000-b7849000 r--p 000a4000 08:05 330652 /usr/lib/libgstreamer-0.10.so.0.17.0 b7849000-b784b000 rw-p 000a7000 08:05 330652 /usr/lib/libgstreamer-0.10.so.0.17.0 b784b000-b7874000 r-xp 00000000 08:05 332167 /usr/lib/libgstbase-0.10.so.0.17.0 b7874000-b7875000 r--p 00028000 08:05 332167 /usr/lib/libgstbase-0.10.so.0.17.0 b7875000-b7876000 rw-p 00029000 08:05 332167 /usr/lib/libgstbase-0.10.so.0.17.0 b7876000-b787a000 r-xp 00000000 08:05 332169 /usr/lib/libgstdataprotocol-0.10.so.0.17.0 b787a000-b787b000 r--p 00003000 08:05 332169 /usr/lib/libgstdataprotocol-0.10.so.0.17.0 b787b000-b787c000 rw-p 00004000 08:05 332169 /usr/lib/libgstdataprotocol-0.10.so.0.17.0 b787c000-b7882000 r-xp 00000000 08:05 332171 /usr/lib/libgstnet-0.10.so.0.17.0 b7882000-b7883000 r--p 00005000 08:05 332171 /usr/lib/libgstnet-0.10.so.0.17.0 b7883000-b7884000 rw-p 00006000 08:05 332171 /usr/lib/libgstnet-0.10.so.0.17.0 b7884000-b78a5000 r-xp 00000000 08:05 332168 /usr/lib/libgstcontroller-0.10.so.0.17.0 b78a5000-b78a6000 r--p 00020000 08:05 332168 /usr/lib/libgstcontroller-0.10.so.0.17.0 b78a6000-b78a7000 rw-p 00021000 08:05 332168 /usr/lib/libgstcontroller-0.10.so.0.17.0 b78a7000-b7903000 r-xp 00000000 08:05 559116 /usr/lib/python2.5/site-packages/gst-0.10/gst/_gst.so b7903000-b7907000 r--p 0005b000 08:05 559116 /usr/lib/python2.5/site-packages/gst-0.10/gst/_gst.so b7907000-b790c000 rw-p 0005f000 08:05 559116 /usr/lib/python2.5/site-packages/gst-0.10/gst/_gst.so b790c000-b79c4000 r-xp 00000000 08:05 3246830 /usr/lib/libglib-2.0.so.0.1400.6 b79c4000-b79c5000 rw-p 000b7000 08:05 3246830 /usr/lib/libglib-2.0.so.0.1400.6 b79c5000-b79cc000 r-xp 00000000 08:05 1935396 /lib/librt-2.6.1.so b79cc000-b79cd000 r--p 00006000 08:05 1935396 /lib/librt-2.6.1.so b79cd000-b79ce000 rw-p 00007000 08:05 1935396 /lib/librt-2.6.1.so b79ce000-b79d1000 r-xp 00000000 08:05 3246633 /usr/lib/libgthread-2.0.so.0.1400.6 b79d1000-b79d2000 rw-p 00003000 08:05 3246633 /usr/lib/libgthread-2.0.so.0.1400.6 b79d2000-b7a08000 r-xp 00000000 08:05 3246639 /usr/lib/libgobject-2.0.so.0.1400.6 b7a08000-b7a09000 rw-p 00036000 08:05 3246639 /usr/lib/libgobject-2.0.so.0.1400.6 b7a09000-b7a2c000 r-xp 00000000 08:05 1182138 /usr/lib/python2.5/site-packages/gtk-2.0/gobject/_gobject.so b7a2c000-b7a2d000 r--p 00022000 08:05 1182138 /usr/lib/python2.5/site-packages/gtk-2.0/gobject/_gobject.so b7a2d000-b7a30000 rw-p 00023000 08:05 1182138 /usr/lib/python2.5/site-packages/gtk-2.0/gobject/_gobject.so b7a30000-b7be3000 r--p 00000000 08:05 331939 /usr/lib/locale/locale-archive b7be3000-b7c67000 rw-p b7be3000 00:00 0 b7c67000-b7d91000 r-xp 00000000 08:05 1935405 /lib/libc-2.6.1.so b7d91000-b7d93000 r--p 0012a000 08:05 1935405 /lib/libc-2.6.1.so b7d93000-b7d94000 rw-p 0012c000 08:05 1935405 /lib/libc-2.6.1.so b7d94000-b7d97000 rw-p b7d94000 00:00 0 b7d97000-b7dbb000 r-xp 00000000 08:05 1933492 /lib/libm-2.6.1.so b7dbb000-b7dbc000 r--p 00023000 08:05 1933492 /lib/libm-2.6.1.so b7dbc000-b7dbd000 rw-p 00024000 08:05 1933492 /lib/libm-2.6.1.so b7dbd000-b7dbf000 r-xp 00000000 08:05 1935403 /lib/libutil-2.6.1.so b7dbf000-b7dc0000 r--p 00001000 08:05 1935403 /lib/libutil-2.6.1.so b7dc0000-b7dc1000 rw-p 00002000 08:05 1935403 /lib/libutil-2.6.1.so b7dc1000-b7dc3000 r-xp 00000000 08:05 1935385 /lib/libdl-2.6.1.so b7dc3000-b7dc4000 r--p 00001000 08:05 1935385 /lib/libdl-2.6.1.so b7dc4000-b7dc5000 rw-p 00002000 08:05 1935385 /lib/libdl-2.6.1.so b7dc5000-b7dd8000 r-xp 00000000 08:05 1933409 /lib/libpthread-2.6.1.so b7dd8000-b7dd9000 r--p 00013000 08:05 1933409 /lib/libpthread-2.6.1.so b7dd9000-b7dda000 rw-p 00014000 08:05 1933409 /lib/libpthread-2.6.1.so b7dda000-b7ddc000 rw-p b7dda000 00:00 0 b7ddc000-b7ec6000 r-xp 00000000 08:05 330244 /usr/lib/libpython2.5.so.1.0 b7ec6000-b7ec7000 r--p 000e9000 08:05 330244 /usr/lib/libpython2.5.so.1.0 b7ec7000-b7eed000 rw-p 000ea000 08:05 330244 /usr/lib/libpython2.5.so.1.0 b7eed000-b7ef4000 rw-p b7eed000 00:00 0 b7ef8000-b7f01000 r-xp 00000000 08:05 362059 /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1 b7f01000-b7f02000 r--p 00008000 08:05 362059 /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1 b7f02000-b7f03000 rw-p 00009000 08:05 362059 /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1 b7f03000-b7f04000 rw-p b7f03000 00:00 0 b7f04000-b7f05000 r-xp b7f04000 00:00 0 [vdso] b7f05000-b7f1f000 r-xp 00000000 08:05 1935404 /lib/ld-2.6.1.so b7f1f000-b7f20000 r--p 00019000 08:05 1935404 /lib/ld-2.6.1.so b7f20000-b7f21000 rw-p 0001a000 08:05 1935404 /lib/ld-2.6.1.so bf869000-bf87e000 rw-p bffeb000 00:00 0 [stack] Aborted Other information:
Your program should start with 'import gobject; gobject.threads_init()'
The real problem is a bit more complicated than that :) The problem is that some gst.message_new_*() functions take the ownership of the passed gst.Structure/gst.TagList. Currently the integrated codegenerator doesn't have any handling of boxed arguments whose reference are taken.
2008-12-06 Edward Hervey <edward.hervey@collabora.co.uk> * codegen/argtypes.py: Add handling of 'keep-refcount' for GBoxed arguments. * gst/gst.defs: Mark the appropriate 'gst_message_new_*' arguments when the method takes the ownership of the passed gst.Structure/gst.TagList * testsuite/test_message.py: Test for creating messages that take a gst.Structure/gst.TagList as argument and make sure they're properly created. Fixes #556054