Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with dialogs #289

Open
pztrn opened this issue Nov 20, 2016 · 10 comments
Open

Problem with dialogs #289

pztrn opened this issue Nov 20, 2016 · 10 comments

Comments

@pztrn
Copy link
Contributor

pztrn commented Nov 20, 2016

Hello.

Trying to run urtrator (https://github.com/pztrn/urtrator) on fully updated CentOS 7. Everything builds and run fine, except dialogs. When I'm trying to show dialog (e.g. https://github.com/pztrn/urtrator/blob/master/ui/options.go#L70) this errors appeared:

*** Error in `/home/parallels/.go/workspace/bin/./urtrator': malloc(): memory corruption (fast): 0x00000000010a7320 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7b194)[0x7ffff4f6e194]
/lib64/libc.so.6(+0x7e917)[0x7ffff4f71917]
/lib64/libc.so.6(__libc_malloc+0x4c)[0x7ffff4f7326c]
/lib64/libxcb.so.1(+0xc7a2)[0x7ffff1c8c7a2]
/lib64/libxcb.so.1(+0xcaf8)[0x7ffff1c8caf8]
/lib64/libX11.so.6(+0x425c9)[0x7ffff49f35c9]
/lib64/libX11.so.6(+0x42746)[0x7ffff49f3746]
/lib64/libX11.so.6(_XEventsQueued+0x5d)[0x7ffff49f3a2d]
/lib64/libX11.so.6(XPending+0x4d)[0x7ffff49e555d]
/lib64/libgdk-x11-2.0.so.0(+0x5ce3c)[0x7ffff74f2e3c]
/lib64/libglib-2.0.so.0(g_main_context_check+0x171)[0x7ffff5bc6501]
/lib64/libglib-2.0.so.0(+0x49a03)[0x7ffff5bc6a03]
/lib64/libglib-2.0.so.0(g_main_loop_run+0x6a)[0x7ffff5bc6dca]
/lib64/libgtk-x11-2.0.so.0(gtk_dialog_run+0x1be)[0x7ffff7818cfe]
/home/parallels/.go/workspace/bin/./urtrator(_cgo_8cf5db2797da_Cfunc_gtk_dialog_run+0x17)[0x676907]
/home/parallels/.go/workspace/bin/./urtrator[0x49a460]
======= Memory map: ========
00400000-009e7000 r-xp 00000000 fd:02 528111                             /home/parallels/.go/workspace/bin/urtrator
00be7000-00be9000 r--p 005e7000 fd:02 528111                             /home/parallels/.go/workspace/bin/urtrator
00be9000-00c0a000 rw-p 005e9000 fd:02 528111                             /home/parallels/.go/workspace/bin/urtrator
00c0a000-010e0000 rw-p 00000000 00:00 0                                  [heap]
c000000000-c000002000 rw-p 00000000 00:00 0 
c41ffd8000-c420500000 rw-p 00000000 00:00 0 
7fffd8000000-7fffd8021000 rw-p 00000000 00:00 0 
7fffd8021000-7fffdc000000 ---p 00000000 00:00 0 
7fffdc000000-7fffdc021000 rw-p 00000000 00:00 0 
7fffdc021000-7fffe0000000 ---p 00000000 00:00 0 
7fffe0000000-7fffe0022000 rw-p 00000000 00:00 0 
7fffe0022000-7fffe4000000 ---p 00000000 00:00 0 
7fffe4cd3000-7fffe4cd4000 ---p 00000000 00:00 0 
7fffe4cd4000-7fffe54d4000 rw-p 00000000 00:00 0                          [stack:5172]
7fffe54d4000-7fffe5548000 rw-p 00000000 00:00 0 
7fffe5570000-7fffe55c1000 rw-p 00000000 00:00 0 
7fffe55c1000-7fffe5621000 rw-s 00000000 00:04 1933326                    /SYSV00000000 (deleted)
7fffe5621000-7fffe5628000 r-xp 00000000 fd:00 927792                     /usr/lib64/gtk-2.0/2.10.0/immodules/im-xim.so
7fffe5628000-7fffe5827000 ---p 00007000 fd:00 927792                     /usr/lib64/gtk-2.0/2.10.0/immodules/im-xim.so
7fffe5827000-7fffe5828000 r--p 00006000 fd:00 927792                     /usr/lib64/gtk-2.0/2.10.0/immodules/im-xim.so
7fffe5828000-7fffe5829000 rw-p 00007000 fd:00 927792                     /usr/lib64/gtk-2.0/2.10.0/immodules/im-xim.so
7fffe5829000-7fffe5889000 rw-s 00000000 00:04 1835021                    /SYSV00000000 (deleted)
7fffe5889000-7fffe5939000 r--p 00000000 fd:00 658549                     /usr/share/fonts/dejavu/DejaVuSans.ttf
7fffe5939000-7fffe593b000 r--s 00000000 fd:00 2621519                    /var/cache/fontconfig/87f5e051180a7a75f16eb6fe7dbd3749-le64.cache-4
7fffe593b000-7fffe5946000 r--s 00000000 fd:00 2621515                    /var/cache/fontconfig/b79f3aaa7d385a141ab53ec885cc22a8-le64.cache-4
7fffe5946000-7fffe5949000 r--s 00000000 fd:00 2621527                    /var/cache/fontconfig/0b1bcc92b4d25cc154d77dafe3bceaa0-le64.cache-4
7fffe5949000-7fffe594b000 r--s 00000000 fd:00 2622304                    /var/cache/fontconfig/711dae798b6bff4224ea2776edcb5c93-le64.cache-4
7fffe594b000-7fffe594d000 r--s 00000000 fd:00 2622302                    /var/cache/fontconfig/2e1514a9fdd499050989183bb65136db-le64.cache-4
7fffe594d000-7fffe5957000 r--s 00000000 fd:00 2622309                    /var/cache/fontconfig/75726aeed9fe8691fd29315754d820cc-le64.cache-4
7fffe5957000-7fffe5959000 r--s 00000000 fd:00 2622286                    /var/cache/fontconfig/3f821257dd33660ba7bbb45c32deb84c-le64.cache-4
7fffe5959000-7fffe595c000 r--s 00000000 fd:00 2622289                    /var/cache/fontconfig/830f035fa84a65ce80e050178dbb630d-le64.cache-4
7fffe595c000-7fffe595d000 r--s 00000000 fd:00 2622301                    /var/cache/fontconfig/81a173283b451552b599cfaafd6236bd-le64.cache-4
7fffe595d000-7fffe595e000 r--s 00000000 fd:00 2622311                    /var/cache/fontconfig/ac68f755438cc3dc5a526084839fc7ca-le64.cache-4
7fffe595e000-7fffe595f000 r--s 00000000 fd:00 2622297                    /var/cache/fontconfig/f951a6bc01c50d58ac4af16a0108457e-le64.cache-4
7fffe595f000-7fffe5960000 r--s 00000000 fd:00 2622296                    /var/cache/fontconfig/12513961c6e7090f8648812f9eaf65d6-le64.cache-4
7fffe5960000-7fffe5963000 r--s 00000000 fd:00 2622287                    /var/cache/fontconfig/e26bf336397aae6fcef4d3803472adec-le64.cache-4
7fffe5963000-7fffe5964000 r--s 00000000 fd:00 2622288                    /var/cache/fontconfig/f132fa2327207a6ac3298c0518879731-le64.cache-4
Program received signal SIGABRT, Aborted.
0x00007ffff4f285f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56	  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
(gdb) bt
#0  0x00007ffff4f285f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff4f29ce8 in __GI_abort () at abort.c:90
#2  0x00007ffff4f68327 in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff5072488 "*** Error in `%s': %s: 0x%s ***\n")
    at ../sysdeps/unix/sysv/linux/libc_fatal.c:196
#3  0x00007ffff4f6e194 in malloc_printerr (action=<optimized out>, str=0x7ffff5072650 "malloc(): memory corruption (fast)", ptr=<optimized out>, ar_ptr=<optimized out>)
    at malloc.c:5022
#4  0x00007ffff4f71917 in _int_malloc (av=av@entry=0x7ffff52ae760 <main_arena>, bytes=bytes@entry=16) at malloc.c:3382
#5  0x00007ffff4f7326c in __GI___libc_malloc (bytes=16) at malloc.c:2895
#6  0x00007ffff1c8c7a2 in _xcb_in_read (c=0xdada50) at xcb_in.c:320
#7  0x00007ffff1c8c7a2 in _xcb_in_read (c=c@entry=0xdada50) at xcb_in.c:979
#8  0x00007ffff1c8caf8 in poll_for_next_event (c=0xdada50, queued=queued@entry=0) at xcb_in.c:684
#9  0x00007ffff1c8cb17 in xcb_poll_for_event (c=<optimized out>) at xcb_in.c:693
#10 0x00007ffff49f35c9 in poll_for_event (dpy=dpy@entry=0xdac800) at xcb_io.c:242
#11 0x00007ffff49f3746 in poll_for_response (dpy=dpy@entry=0xdac800) at xcb_io.c:274
#12 0x00007ffff49f3a2d in _XEventsQueued (dpy=dpy@entry=0xdac800, mode=mode@entry=2) at xcb_io.c:349
#13 0x00007ffff49e555d in XPending (dpy=0xdac800) at Pending.c:55
#14 0x00007ffff74f2dd1 in gdk_check_xpending (display=<optimized out>) at gdkevents-x11.c:159
#15 0x00007ffff74f2e3c in gdk_event_check (source=0xdc2a30) at gdkevents-x11.c:2400
#16 0x00007ffff5bc6501 in g_main_context_check (context=context@entry=0xdc2b20, max_priority=2147483647, fds=fds@entry=0xf7a180, n_fds=n_fds@entry=2) at gmain.c:3620
#17 0x00007ffff5bc6a03 in g_main_context_iterate (context=0xdc2b20, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3776
#18 0x00007ffff5bc6dca in g_main_loop_run (loop=0xf9c940) at gmain.c:3973
#19 0x00007ffff7818cfe in IA__gtk_dialog_run (dialog=0x10a4050 [GtkMessageDialog]) at gtkdialog.c:1094
#20 0x0000000000676907 in _cgo_8cf5db2797da_Cfunc_gtk_dialog_run (v=0xc420049698) at /home/parallels/.go/workspace/src/github.com/mattn/go-gtk/gtk/gtk.go:5853
#21 0x000000000049a460 in runtime.asmcgocall () at /home/parallels/.go/bin/src/runtime/asm_amd64.s:590
#22 0x000000c420049628 in  ()
#23 0x000000000044522d in runtime.cgocall (fn=0x7ffff7816f30 <gtk_container_expose_child>, arg=0x7fffffffcfb8, ~r2=4826350)
    at /home/parallels/.go/bin/src/runtime/cgocall.go:115
#24 0x00007fffffffdd80 in  ()
Python Exception <type 'exceptions.RuntimeError'> Cannot locate object file for block.: 
#25 0x00007ffff7816f30 in gtk_container_expose_child#26 0x00007fffffffcfb8 in  ()
#27 0x000000000049a4ee in runtime.cgocallback () at /home/parallels/.go/bin/src/runtime/asm_amd64.s:639
#28 0x0000000000572e2c in _cgoexp_b00a5877f6a0__go_glib_callback ()
#29 0x000000000062a6b2 in crosscall2 () at /home/parallels/.go/bin/src/runtime/cgo/asm_amd64.s:61
#30 0x00007fffffffd060 in  ()
#31 0x0000000000000008 in  ()
#32 0x0000000000000000 in  ()

Also, I've tested on Debian 8 (fully updated) - and very same error :(. So I doubt that this related to OS or GTK+2 build.

Also, macOS and Windows (7 and 2012r2) are fine, dialog shows normally.

@mattn
Copy link
Owner

mattn commented Nov 20, 2016

I'll look into it in later

@pztrn
Copy link
Contributor Author

pztrn commented Nov 21, 2016

After more tests: it does not depend on glib/gdk thread-awareness, tested with and without them.

@mattn
Copy link
Owner

mattn commented Nov 21, 2016

Hmm, I don't reproduce this as your said. I need to make development-environment for gtk.

@pztrn
Copy link
Contributor Author

pztrn commented Nov 21, 2016

Done more tests: demo app works fine, I can see file selection dialog, and no crash. Also, if I remove dialog - application continue to work flawlessly. Also, simple app:

package main

import (
    "github.com/mattn/go-gtk/gtk"
)

func main() {
	gtk.Init(nil)
	m := gtk.NewMessageDialog(nil, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, "Test")
	m.Response(func() {
        	m.Destroy()
	})
	m.Run()
	gtk.Main()
}

Also shows dialog fine.

pztrn added a commit to pztrn/urtrator that referenced this issue Nov 21, 2016
@mattn
Copy link
Owner

mattn commented Nov 22, 2016

Also shows dialog fine.

This is tested on Linux?

@pztrn
Copy link
Contributor Author

pztrn commented Nov 22, 2016

Yes, on Centos 7 and Ubuntu 14.04, sorry for not mentioning it.

@mattn
Copy link
Owner

mattn commented Nov 22, 2016

Yes, on Centos 7 and Ubuntu 14.04, sorry for not mentioning it.

NP. Then still have issue?

@pztrn
Copy link
Contributor Author

pztrn commented Nov 22, 2016

Yep, I have to disable MessageDialog generation on Linuxes in URTrator to get around it. :( https://github.com/pztrn/urtrator/tree/6495e9073704ce0658d63a6692b810f7e0807a8c is a last commit before I workarounded this bug (or my bad hands?).

@mattn
Copy link
Owner

mattn commented Nov 22, 2016

or my bad hands?

Should be a bug of go-gtk.

@mattn
Copy link
Owner

mattn commented Nov 23, 2016

I tried your code on Ubuntu 16.04 (clean installed) and go1.7.3. But can't reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants