[Lazarus] Need testers (gtk2)

2010-10-24 Thread zeljko
Hi,
I've commited an important patch today (r 27829) , about gtk2 main loop 
iterations.
Now it uses g_main_context instead of g_main which is deprecated from 
gtk2-2.2.
This patch improves main loop, but also now PostMessage() works fine for 
messages from another threads.

*** Gtk2 Laz/LCL must be build with -dUSE_GTK_MAIN_CONTEXT_ITERATION ***
to get this new code work.

If you find any issues about it, please open it's # at bugtracker.
After while I'll set USE_GTK_MAIN_CONTEXT_ITERATION as default, so -d won't be 
needed anymore.

I've tested under: Fedora 3 (gtk2-2.12), Fedora 13 (gtk2-2.20), Ubuntu 10.4 
64bit (gtk2-2.20).
Gtk2 version isn't important here, but glib2 version is, so if you open any 
issue about main loop problems, please provide next informations:

1.Linux distribution  version + 32 or 64 bit 
2.Gtk2 version
3.Glib2 version.
4.Provide an simple example where I can reproduce your problem.

thanks.

thanks
  zeljko

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Need testers (gtk2)

2010-10-24 Thread Juha Manninen
On Sunday 24 October 2010 15:24:04 zeljko wrote:
 Hi,
 I've commited an important patch today (r 27829) , about gtk2 main loop
 iterations.
 Now it uses g_main_context instead of g_main which is deprecated from
 gtk2-2.2.
 This patch improves main loop, but also now PostMessage() works fine for
 messages from another threads.
 
 *** Gtk2 Laz/LCL must be build with -dUSE_GTK_MAIN_CONTEXT_ITERATION ***
 to get this new code work.

In my short tests it works well. I didn't notice difference for older versions.
I will try PostMessage later.

I just happened to debug a GTK2 program. It is the thtmlport package from CCR. 
It looks like a useful package but it crashes with GTK2. This bug seems to be 
extremely difficult to find. It shows this:

(lazarus:2791): Gdk-CRITICAL **: gdk_window_get_state: assertion 
`GDK_IS_WINDOW (window)' failed
[DBGTGT] Gdk-ERROR **: The program 'framedem' received an X Window System 
error.
[DBGTGT] This probably reflects a bug in the program.
[DBGTGT] The error was 'BadMatch (invalid parameter attributes)'.
[DBGTGT]   (Details: serial 2256 error_code 8 request_code 62 minor_code 0)
[DBGTGT]   (Note to programmers: normally, X errors are reported 
asynchronously;
[DBGTGT]that is, you will receive the error a while after causing it.
[DBGTGT]To debug your program, run it with the --sync command line
[DBGTGT]option to change this behavior. You can then get a meaningful
[DBGTGT]backtrace from your debugger if you break on the gdk_x_error() 
function.)
[DBGTGT] aborting...


Question: how can I give  --sync parameter for the program when I run it under 
gdb? I tried:

 $ gdb 'framedem --sync'
which says:
 framedem --sync: No such file or directory.

and:

 $ gdb framedem --sync
which says:
 gdb: unrecognized option '--sync'
 Use `gdb --help' for a complete list of options.

I can give the parameter in Lazarus Run Parameters... but then the whole 
Lazarus freezes. It doesn't take mouse clicks and must be killed.

Juha

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Need testers (gtk2)

2010-10-24 Thread Mark Morgan Lloyd

Juha Manninen wrote:

Question: how can I give  --sync parameter for the program when I run it under 
gdb? I tried:


 $ gdb 'framedem --sync'
which says:
 framedem --sync: No such file or directory.

and:

 $ gdb framedem --sync
which says:
 gdb: unrecognized option '--sync'
 Use `gdb --help' for a complete list of options.

I can give the parameter in Lazarus Run Parameters... but then the whole 
Lazarus freezes. It doesn't take mouse clicks and must be killed.


From my limited experience with general debugging, try

gdb framedem
(gdb) set args --sync
(gdb) run

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Need testers (gtk2)

2010-10-24 Thread Felipe Monteiro de Carvalho
On Sun, Oct 24, 2010 at 3:32 PM, Juha Manninen
juha.mannine...@gmail.com wrote:
 Question: how can I give  --sync parameter for the program when I run it under
 gdb? I tried:

  $ gdb 'framedem --sync'

gdb framedem

And then inside gdb:

run --sync

-- 
Felipe Monteiro de Carvalho

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Need testers (gtk2)

2010-10-24 Thread zeljko
On Sunday 24 October 2010 15:32, Juha Manninen wrote:
 On Sunday 24 October 2010 15:24:04 zeljko wrote:
  Hi,
  I've commited an important patch today (r 27829) , about gtk2 main loop
  iterations.
  Now it uses g_main_context instead of g_main which is deprecated from
  gtk2-2.2.
  This patch improves main loop, but also now PostMessage() works fine for
  messages from another threads.
 
  *** Gtk2 Laz/LCL must be build with -dUSE_GTK_MAIN_CONTEXT_ITERATION ***
  to get this new code work.

 In my short tests it works well. I didn't notice difference for older
 versions. I will try PostMessage later.

This update is mostly commited because of PostMessage() :), but also affects 
unthreaded apps, because our message queue does not rely on critical 
sections, but parallel g_main_context, which is more effective in multi 
threaded environment.

  $ gdb framedem --sync
 which says:
  gdb: unrecognized option '--sync'
  Use `gdb --help' for a complete list of options.

 I can give the parameter in Lazarus Run Parameters... but then the whole
 Lazarus freezes. It doesn't take mouse clicks and must be killed.

Isn't standard X11 param with one - eg. ./myprogram -sync ?

zeljko

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Need testers (gtk2)

2010-10-24 Thread waldo kitty

On 10/24/2010 11:53, zeljko wrote:

On Sunday 24 October 2010 15:32, Juha Manninen wrote:

I can give the parameter in Lazarus Run Parameters... but then the whole
Lazarus freezes. It doesn't take mouse clicks and must be killed.


Isn't standard X11 param with one - eg. ./myprogram -sync ?


full word params has two dashes... single character params have one dash...

foo -V
foo --version

the above might return the same result in program foo...


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Need testers (gtk2)

2010-10-24 Thread zeljko
On Sunday 24 October 2010 17:56, waldo kitty wrote:
 On 10/24/2010 11:53, zeljko wrote:
  On Sunday 24 October 2010 15:32, Juha Manninen wrote:
  I can give the parameter in Lazarus Run Parameters... but then the
  whole Lazarus freezes. It doesn't take mouse clicks and must be killed.
 
  Isn't standard X11 param with one - eg. ./myprogram -sync ?

 full word params has two dashes... single character params have one dash...

 foo -V
 foo --version

 the above might return the same result in program foo...


Are you sure ? I'm talking about XOrg standard params, not about gtk2 or any 
other ws ...
xterm -sync - works ok
xterm --sync - doesn't work

zeljko


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Need testers (gtk2)

2010-10-24 Thread Juha Manninen
On Sunday 24 October 2010 18:56:18 waldo kitty wrote:
  Isn't standard X11 param with one - eg. ./myprogram -sync ?
 
 full word params has two dashes... single character params have one dash...
 
 foo -V
 foo --version
 
 the above might return the same result in program foo...

Thanks Marc and Felipe for your help. 
Both run --sync and set args --sync work equally well.

Zeljan, I tested also a single dash (-sync) but it doesn't work. It says:

Starting program: /home/juha/SW/Pascal/thtmlport2/demo_src/framedem -sync
[Thread debugging using libthread_db enabled]
Detaching after fork from child process 4763.
Detaching after fork from child process 4764.
TApplication.HandleException Can't locate file: -sync
  Stack trace:
  $00849E34 line 2600 of framview.pas
  ...

and the stack trace is not very helpfull.

With double dash it gives the following stack trace. Note: I don't expect 
anyone else to solve it. It is here just for curiosity. I must say I am little 
obsessed with this bug now...
And sorry for hijacking this thread, I will get back to the original issue 
later.

Juha

---

Program received signal SIGABRT, Aborted.
0x0032df0329a5 in raise (sig=6) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
64return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
Missing separate debuginfos, use: debuginfo-install atk-1.30.0-1.fc13.x86_64 
cairo-1.8.10-1.fc13.x86_64 expat-2.0.1-10.fc13.x86_64 
fontconfig-2.8.0-1.fc13.x86_64 freetype-2.3.11-6.fc13.x86_64 
gtk2-2.20.1-1.fc13.x86_64 libXcomposite-0.4.1-2.fc13.x86_64 
libXdamage-1.1.2-2.fc13.x86_64 libXi-1.3.2-1.fc13.x86_64 
libXinerama-1.1-2.fc13.x86_64 libXrandr-1.3.0-5.fc13.x86_64 
libselinux-2.0.94-2.fc13.x86_64 libxcb-1.5-1.fc13.x86_64 
pango-1.28.0-1.fc13.x86_64 pixman-0.18.0-1.fc13.x86_64 qtcurve-
gtk2-1.6.3-1.fc13.x86_64
(gdb) bt
#0  0x0032df0329a5 in raise (sig=6) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x0032df034185 in abort () at abort.c:92
#2  0x0032e084668a in IA__g_logv (log_domain=0x3d5cc7f2d4 Gdk, 
log_level=value optimized out, format=0x3d5cc9d567 %s, 
args1=0x7fff9ed0) 
at gmessages.c:549
#3  0x0032e0846723 in IA__g_log (log_domain=value optimized out, 
log_level=value optimized out, format=value optimized out) at 
gmessages.c:569
#4  0x003d5cc686e6 in ?? () from /usr/lib64/libgdk-x11-2.0.so.0
#5  0x0032e1446b24 in _XError (dpy=0xe68a00, rep=0x1105080) at 
XlibInt.c:3103
#6  0x0032e144cf7c in process_responses (dpy=0xe68a00, 
wait_for_first_event=0, current_error=0x7fffa1c0, current_request=2319) at 
xcb_io.c:214
#7  0x0032e144d610 in _XReply (dpy=0xe68a00, rep=0x7fffa210, extra=0, 
discard=1) at xcb_io.c:464
#8  0x0032e1441093 in XSync (dpy=0xe68a00, discard=0) at Sync.c:48
#9  0x0032e144124b in _XSyncFunction (dpy=value optimized out) at 
Synchro.c:37
#10 0x0032e1420740 in XCopyArea (dpy=0xe68a00, src_drawable=106955094, 
dst_drawable=106955100, gc=0x10e98b0, src_x=0, src_y=0, width=16, height=16, 
dst_x=0, dst_y=0) at CopyArea.c:63
#11 0x003d5cc2319c in gdk_draw_drawable () from /usr/lib64/libgdk-
x11-2.0.so.0
#12 0x00775ed1 in GDK2_GDK_DRAW_PIXMAP$crcB87764AF ()
#13 0x00776d18 in GDK2_GDK_WINDOW_COPY_AREA$crcDE8FE071 ()
#14 0x006b7fad in SCALEANDROP (parentfp=0x7fffa610, 
DESTGC=0x10f9950, 
SRC=0x10e2920, SRCPIXMAP=0x10e2920, SRCMASKBITMAP=0x0) at 
gtk2widgetset.inc:3824
#15 0x006b79f2 in SRCDEVBITMAPTODRAWABLE (parentfp=0x7fffa610) at 
gtk2widgetset.inc:3920
#16 0x006b780d in DRAWABLETODRAWABLE (parentfp=0x7fffa610) at 
gtk2widgetset.inc:3984
#17 0x006b7355 in STRETCHCOPYAREA (this=0x77f8c170, 
DESTDC=140737244692816, X=0, Y=0, WIDTH=16, HEIGHT=16, SRCDC=140737244696496, 
XSRC=0, YSRC=0, SRCWIDTH=16, SRCHEIGHT=16, 
MASK=0, XMASK=0, YMASK=0, ROP=3342344) at gtk2widgetset.inc:4261
#18 0x006d5ec8 in STRETCHBLT (this=0x77f8c170, 
DESTDC=140737244692816, X=0, Y=0, WIDTH=16, HEIGHT=16, SRCDC=140737244696496, 
XSRC=0, YSRC=0, SRCWIDTH=16, SRCHEIGHT=16, ROP=
3342344) at gtk2winapi.inc:9086
#19 0x006bcfb5 in BITBLT (this=0x77f8c170, DESTDC=140737244692816, 
X=0, Y=0, WIDTH=16, HEIGHT=16, SRCDC=140737244696496, XSRC=0, YSRC=0, 
ROP=3342344) at gtk2winapi.inc:184
#20 0x0058215c in BITBLT (DESTDC=140737244692816, X=0, Y=0, WIDTH=16, 
HEIGHT=16, SRCDC=140737244696496, XSRC=0, YSRC=0, ROP=3342344) at 
include/winapi.inc:53
#21 0x008981ba in FINISHTRANSPARENTBITMAP (AHDC=140737244610128, 
INIMAGE=0x77f85fc0, MASK=0x77f860c0, XSTART=104, YSTART=299, W=16, 
H=16) 
at htmlun2.pas:2346
#22 0x00865ef8 in DODRAW (this=0x71ed78c0, CANVAS=0x7174b100, 
XX=104, Y=299, DDIMAGE=0x77f85fc0, DDMASK=0x77f860c0) at 
htmlsubs.pas:2643
#23 0x008665ad in DRAW (this=0x71ed78c0, CANVAS=0x7174b100, 
X=100, 
TOPY=303, YBASELINE=315, FO=0x717c95c0) at htmlsubs.pas:2764
#24 0x0088bcb7 in