Re: [lazarus] Making GTK Thread Safe
Giuliano Colla wrote: Al Boldi ha scritto: For now, when you start a thread non-suspended, TThread.Execute(false), can you see the memory increase for your project1 app when checking with top? Then, when you TThread.WaitFor/TThread.Free, does it decrease? And by how much? Below is the simplified console app. Thanks for the feedback! Feedback: I couldn't see any change with top, so I slightly modified your console app, by adding: writeln('Type Enter to start thread'); readln(ans); before t1:=TThreadBug.Create(false); Ok, much better! With Lazarus 0.9.4.1, fpc 2.2.0 the result is the following: before starting the thread TOP says: 4732 colla 16 0 2564 808 488 S0 0.1 0:00.00 threadbug after the thread is started it becomes: 4732 colla 15 0 12860 916 576 S0 0.1 0:00.00 threadbug That's a huge increase; almost 12mb. On fpc2.0.2/linux2.6.22 it increases by ~2mb, a lot less, but still large. Can somebody check what the gcc thread overhead is? and it doesn't change anymore until program termination, either typing y or n. If this is with v2.2.0, then this means a regression on top of a bug. I tried to set true FreeOnTerminate of your thread (with proper adjustments, because WaitFor and Free don't work anymore, of course) but there's no change. For sake of completeness, I made the same with my test program, where I can terminate, free and restart the thread multiple times, and I see the memory usage increasing each time: it started with 12Kb You mean 12mb, right? and I stopped when it had become 122Mb! However all memory is released before closing the program, because heaptrc correctly reports an increasing number of blocks allocated and freed, as a function of the number of times I started my thread. I don't think heaptrc detects RTL associated OS leaks. It only detects RTL object leaks, and it seems those are freed correctly. As soon as I can, I'd like to perform the same tests with Kylix, to see if it makes a difference. Thanks a lot! -- Al _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] FastZLib: Illegal COFF Magic
On Fri, 4 Jan 2008, Lukas Gradl wrote: Michael Van Canneyt schrieb: On Fri, 4 Jan 2008, Lukas Gradl wrote: Sorry to bother you again - but I'm just too stupid to get it to work. Using cygwin I did a gcc -c adler32.c then I renamed the created adler32.o to adler32.obj. But when trying to link I get a Undefined symbol: ZLIBEX... I never used gcc on Windows and I'm quite stuck with this OBJ-Files. For D7 they where compiled using bcc -c -6 -O2 -Ve -X- -pr -a8 -b -d -k- -vi -tWM -r -RT- -DFASTEST -n%OutDir% adler32.c Perhaps someone out there is able to provide me with a little HowTo? Probably the external definitions are using uppercase names, while gcc produces lowercase symbol names. You might be better of using paszlib. Michael, thanks for your contiuous support! If you're coming to Tyrol one day feel free to collect a bunch of espressos at my place... *g* But as I've to talk to an external application using ZLibEx I have to use it too. going back to google again, Try to get the symbol names from the gcc-produced files, you can do this with objdump: objdump -t file.o Then make sure the external definitions in the pascal files match these names exactly. Michael. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] FastZLib: Illegal COFF Magic
Michael, thanks for your contiuous support! If you're coming to Tyrol one day feel free to collect a bunch of espressos at my place... *g* But as I've to talk to an external application using ZLibEx I have to use it too. going back to google again, Try to get the symbol names from the gcc-produced files, you can do this with objdump: objdump -t file.o Then make sure the external definitions in the pascal files match these names exactly. Thanks Michael, already done that and found, that gcc makes an underscore as starting character of every symbol, which bcc doesn't. So another step done... regards Lukas -- software security networks Lukas Gradl lazarus#ssn.at Eduard-Bodem-Gasse 9 A - 6020 Innsbruck Tel: +43-720-300168-0 Fax: +43-512-341033-19 _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Making GTK Thread Safe
Giuliano Colla wrote: Al Boldi ha scritto: For now, when you start a thread non-suspended, TThread.Execute(false), can you see the memory increase for your project1 app when checking with top? Then, when you TThread.WaitFor/TThread.Free, does it decrease? And by how much? Below is the simplified console app. Thanks for the feedback! Feedback: I couldn't see any change with top, so I slightly modified your console app, by adding: writeln('Type Enter to start thread'); readln(ans); before t1:=TThreadBug.Create(false); With Lazarus 0.9.4.1, fpc 2.2.0 the result is the following: before starting the thread TOP says: 4732 colla 16 0 2564 808 488 S0 0.1 0:00.00 threadbug after the thread is started it becomes: 4732 colla 15 0 12860 916 576 S0 0.1 0:00.00 threadbug and it doesn't change anymore until program termination, either typing y or n. I tried to set true FreeOnTerminate of your thread (with proper adjustments, because WaitFor and Free don't work anymore, of course) but there's no change. For sake of completeness, I made the same with my test program, where I can terminate, free and restart the thread multiple times, and I see the memory usage increasing each time: it started with 12Kb and I stopped when it had become 122Mb! However all memory is released before closing the program, because heaptrc correctly reports an increasing number of blocks allocated and freed, as a function of the number of times I started my thread. As soon as I can, I'd like to perform the same tests with Kylix, to see if it makes a difference. Regards, Giuliano I do not think this a fpc problem. In the threat ring benchmark Free Pascal performs almost as well as C. I did run this benchmark without problems. Regards Wim _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Making GTK Thread Safe
willem wrote: Giuliano Colla wrote: Al Boldi ha scritto: For now, when you start a thread non-suspended, TThread.Execute(false), can you see the memory increase for your project1 app when checking with top? Then, when you TThread.WaitFor/TThread.Free, does it decrease? And by how much? Below is the simplified console app. Thanks for the feedback! Feedback: I couldn't see any change with top, so I slightly modified your console app, by adding: writeln('Type Enter to start thread'); readln(ans); before t1:=TThreadBug.Create(false); With Lazarus 0.9.4.1, fpc 2.2.0 the result is the following: before starting the thread TOP says: 4732 colla 16 0 2564 808 488 S0 0.1 0:00.00 threadbug after the thread is started it becomes: 4732 colla 15 0 12860 916 576 S0 0.1 0:00.00 threadbug and it doesn't change anymore until program termination, either typing y or n. I tried to set true FreeOnTerminate of your thread (with proper adjustments, because WaitFor and Free don't work anymore, of course) but there's no change. For sake of completeness, I made the same with my test program, where I can terminate, free and restart the thread multiple times, and I see the memory usage increasing each time: it started with 12Kb and I stopped when it had become 122Mb! However all memory is released before closing the program, because heaptrc correctly reports an increasing number of blocks allocated and freed, as a function of the number of times I started my thread. As soon as I can, I'd like to perform the same tests with Kylix, to see if it makes a difference. Regards, Giuliano I do not think this a fpc problem. In the threat ring benchmark Free Pascal performs almost as well as C. I did run this benchmark without problems. Regards Wim I am using kubuntu gutsy. lazarus 0.9.24 -386-linux-gtk fpc 2.2.0 and I run the threatbug with no memory leaks. i did remove the readln 's and added a for loop. threadbug ran then 10 000 times without memory leaks on my system. regards Wim _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] accessing internal widgetset handle
Hi all, I'd like to create a gtk(2) app that has a non-rectangular form shape, using Lazarus of course. I know gtk(2) provides API for this purpose. The API requires a pointer to GTKWidget. But, I couldn't find any ways to get the widget pointer of Lazarus' form since Lazarus wraps the API very well inside LCL. Hints? TIA. BTW... which API should I use for this purpose, gtk or gdk? Both wrappers are provided in FPC/Lazarus and both provide similar API for the purpose. In term of Lazarus' LCL, what are the differences between both? -Bee- has Bee.ography at: http://beeography.wordpress.com _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] Scanlines again
Firstly, I'd like to propose a slight change to the scanlines example so that it is easier for developers to follow the code and to possibly incorporate bits of it into their own code. type TBGRA = packed record b, g, r, a : byte; end; PBGRA = ^TBGRA; TBGRAArray = array[ WORD ] of TBGRA; PBGRAArray = ^TBGRAArray; procedure TForm1.PaintToRGB32bitScanLine(Row, ImgWidth: integer; LineStart: Pointer); // LineStart is pointer to the start of a scanline with the following format: // 4 bytes per pixel. First byte is blue, second green, third is red. // the fourth byte is the Alpha value, which is not specified in this // example // Black is 0,0,0, white is 255,255,255 var i: Integer; lrow : PBGRAArray begin lrow := PBGRAArray( LineStart ) // fill line with gray for i := 0 to ImgWidth - 1 do begin lrow^[ i ].r := 128; // set red to 128 lrow^[ i ].g := 128; // set green to 128 lrow^[ i ].b := 128; // set blue to 128 end; // set one diagonal pixel to red ( this creates a diagonal red line ) lrow^[ ( Row mod ImgWidth ) ].r := 255; // set red to 255 - full intensity lrow^[ ( Row mod ImgWidth ) ].g := 0; // set green to 0 lrow^[ ( Row mod ImgWidth ) ].b := 0; // set blue to 0 end; I think this is a lot easier to understand than the previous version. Secondly, I have a scanline issue that I hope someone on here can help with. I have 2 TImages on a Form ( I'm using Mac OS X if that makes any difference ) one contains an image of a yellow light bulb. I want to copy, pixel by pixel, the image from one TImage over to the second TImage. Yes I know I could just assign the bitmap from one to the other, but this is an exercise in Scanline manipulation. The problem I have is that once copied the second TImage contains a blue light bulb instead of a yellow one. The code I'm using is.. MyBitmap := TBitmap.Create; ScanLineImage := Image1.Picture.Bitmap.CreateIntfImage; MyBitmap.Width := ScanLineImage.Width; MyBitmap.Height:= ScanLineImage.Height; IntfImage := MyBitmap.CreateIntfImage; ImgFormatDescription.Init_BPP32_B8G8R8_BIO_TTB( ScanLineImage.Width, ScanLineImage.Height ); IntfImage.DataDescrption := ImgFormatDescription; for y := 0 to ScanLineImage.Height do begin lrow := ScanLineImage.GetDataLineStart( y ); brow := IntfImage.GetDataLineStart( y ); for x := 0 to ScanLineImage.Width do begin brow^[ x ].r := lrow^[ x ].r; // set red brow^[ x ].g := lrow^[ x ].g; // set green brow^[ x ].b := lrow^[ x ].b; // set blue brow^[ x ].a := lrow^[ x ].a; // set alpha value end; end; MyBitmap.LoadFromIntfImage( IntfImage ); Image2.Picture.Bitmap := MyBitmap; Can anyone see a flaw in my logic of using scanlines for this/this way? Thanks, Dominique. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Making GTK Thread Safe
willem ha scritto: willem wrote: Giuliano Colla wrote: Al Boldi ha scritto: For now, when you start a thread non-suspended, TThread.Execute(false), can you see the memory increase for your project1 app when checking with top? Then, when you TThread.WaitFor/TThread.Free, does it decrease? And by how much? Below is the simplified console app. Thanks for the feedback! Feedback: I couldn't see any change with top, so I slightly modified your console app, by adding: writeln('Type Enter to start thread'); readln(ans); before t1:=TThreadBug.Create(false); With Lazarus 0.9.4.1, fpc 2.2.0 the result is the following: before starting the thread TOP says: 4732 colla 16 0 2564 808 488 S0 0.1 0:00.00 threadbug after the thread is started it becomes: 4732 colla 15 0 12860 916 576 S0 0.1 0:00.00 threadbug and it doesn't change anymore until program termination, either typing y or n. I tried to set true FreeOnTerminate of your thread (with proper adjustments, because WaitFor and Free don't work anymore, of course) but there's no change. For sake of completeness, I made the same with my test program, where I can terminate, free and restart the thread multiple times, and I see the memory usage increasing each time: it started with 12Kb and I stopped when it had become 122Mb! However all memory is released before closing the program, because heaptrc correctly reports an increasing number of blocks allocated and freed, as a function of the number of times I started my thread. As soon as I can, I'd like to perform the same tests with Kylix, to see if it makes a difference. Regards, Giuliano I do not think this a fpc problem. In the threat ring benchmark Free Pascal performs almost as well as C. I did run this benchmark without problems. Regards Wim I am using kubuntu gutsy. lazarus 0.9.24 -386-linux-gtk fpc 2.2.0 and I run the threatbug with no memory leaks. i did remove the readln 's and added a for loop. threadbug ran then 10 000 times without memory leaks on my system. I've realized that information from top is not detailed enough, as it shows only cumulative memory usage. So I've made a more careful analysis using pmap, which provides the memory map of a process. (Usage: pmap [-x] | [-d] PID ) It turns out is that libpthread allocates a 10MB memory chunk (10240Kb to be exact) when a thread is created, and doesn't release it when the thread is destroyed. But it reuses the same chunk when the thread is created again. So the leakage occurs just once. This as far as fpc 2.2.0 is concerned, in a simple context as that of threadbug. With Lazarus, in a slightly more complex test, using the synchronize method you may find as many 10240 kb blocks allocated as the times you started and freed the thread, unless you add an extra WaitFor after teminating the thread, which shouldn't be necessary with FreeOnTerminate. IMHO it's a combination of an fpc bug (there's no reason to keep a 10MB memory block when there's no thread using it) with some obscure Lazarus bug which doesn't allow the thread to fully terminate. Attached is a portion the output of pmap (before starting the thread, after running, and after destroy) for a test where I'd added a large array to the threadbug code: this accounts for an extra 62528 Kb which are correctly allocated and set free. Regards, Giuliano Before Starting the thread: 00a94000 64 - - - r-x-- libpthread-2.4.so 00aa4000 4 - - - r-x-- libpthread-2.4.so 00aa5000 4 - - - rwx-- libpthread-2.4.so 00aa6000 8 - - - rwx--[ anon ] 00b7f000 256 - - - rwx--[ anon ] 00d7b000 4 - - - r-x--[ anon ] 08048000 308 - - - r-x-- threadbug 08095000 116 - - - rwx-- threadbug 080b2000 12 - - - rwx--[ anon ] 09e33000 132 - - - rwx--[ anon ] bfc8e000 88 - - - rwx--[ stack ] --- --- --- --- total kB2548 - - - Thread has run 00a94000 64 - - - r-x-- libpthread-2.4.so 00aa4000 4 - - - r-x-- libpthread-2.4.so 00aa5000 4 - - - rwx-- libpthread-2.4.so 00aa6000 8 - - - rwx--[ anon ] 00b7f000 256 - - - rwx--[ anon ] 00be9000 4 - - - rwx--[ anon ] 00d7b000 4 - - - r-x--[ anon ] 00d7c000 62528 - - - rwx--[ anon ] 04a8c000 4 - - - -[ anon ] 04a8d000 10240 - - - rwx--[ anon ] 08048000 308 - - - r-x-- threadbug 08095000 116 - - - rwx-- threadbug 080b2000 12 - - - rwx--[ anon
Re: [lazarus] accessing internal widgetset handle
On Sun, 06 Jan 2008 01:13:52 +0700 Bee [EMAIL PROTECTED] wrote: Hi all, I'd like to create a gtk(2) app that has a non-rectangular form shape, using Lazarus of course. I know gtk(2) provides API for this purpose. The API requires a pointer to GTKWidget. But, I couldn't find any ways to get the widget pointer of Lazarus' form since Lazarus wraps the API very well inside LCL. Hints? TIA. BTW... which API should I use for this purpose, gtk or gdk? Both wrappers are provided in FPC/Lazarus and both provide similar API for the purpose. In term of Lazarus' LCL, what are the differences between both? Both gtk and gdk are available in the gtk interface. I don't know, which one you use for this. If you need the gtkwindow, then just type cast Form1.Handle: GtkWindow:=PGtkWindow(Form1.Handle); Beware, that this is an internal LCL gtk interface structure and can change in the future without warning. If you find out how to do it, it would be nice to write a small example and describe it on the wiki. Eventually this feature could be added to the LCL. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Making GTK Thread Safe
Giuliano Colla wrote: willem ha scritto: willem wrote: Giuliano Colla wrote: Al Boldi ha scritto: For now, when you start a thread non-suspended, TThread.Execute(false), can you see the memory increase for your project1 app when checking with top? Then, when you TThread.WaitFor/TThread.Free, does it decrease? And by how much? Below is the simplified console app. Thanks for the feedback! Feedback: I couldn't see any change with top, so I slightly modified your console app, by adding: writeln('Type Enter to start thread'); readln(ans); before t1:=TThreadBug.Create(false); With Lazarus 0.9.4.1, fpc 2.2.0 the result is the following: before starting the thread TOP says: 4732 colla 16 0 2564 808 488 S0 0.1 0:00.00 threadbug after the thread is started it becomes: 4732 colla 15 0 12860 916 576 S0 0.1 0:00.00 threadbug and it doesn't change anymore until program termination, either typing y or n. I tried to set true FreeOnTerminate of your thread (with proper adjustments, because WaitFor and Free don't work anymore, of course) but there's no change. For sake of completeness, I made the same with my test program, where I can terminate, free and restart the thread multiple times, and I see the memory usage increasing each time: it started with 12Kb and I stopped when it had become 122Mb! However all memory is released before closing the program, because heaptrc correctly reports an increasing number of blocks allocated and freed, as a function of the number of times I started my thread. As soon as I can, I'd like to perform the same tests with Kylix, to see if it makes a difference. Regards, Giuliano I do not think this a fpc problem. In the threat ring benchmark Free Pascal performs almost as well as C. I did run this benchmark without problems. Regards Wim I am using kubuntu gutsy. lazarus 0.9.24 -386-linux-gtk fpc 2.2.0 and I run the threatbug with no memory leaks. i did remove the readln 's and added a for loop. threadbug ran then 10 000 times without memory leaks on my system. I've realized that information from top is not detailed enough, as it shows only cumulative memory usage. So I've made a more careful analysis using pmap, which provides the memory map of a process. (Usage: pmap [-x] | [-d] PID ) It turns out is that libpthread allocates a 10MB memory chunk (10240Kb to be exact) when a thread is created, and doesn't release it when the thread is destroyed. But it reuses the same chunk when the thread is created again. So the leakage occurs just once. This as far as fpc 2.2.0 is concerned, in a simple context as that of threadbug. With Lazarus, in a slightly more complex test, using the synchronize method you may find as many 10240 kb blocks allocated as the times you started and freed the thread, unless you add an extra WaitFor after teminating the thread, which shouldn't be necessary with FreeOnTerminate. IMHO it's a combination of an fpc bug (there's no reason to keep a 10MB memory block when there's no thread using it) with some obscure Lazarus bug which doesn't allow the thread to fully terminate. Attached is a portion the output of pmap (before starting the thread, after running, and after destroy) for a test where I'd added a large array to the threadbug code: this accounts for an extra 62528 Kb which are correctly allocated and set free. Regards, Giuliano well I made 10 copy's of threadbug and run them in parallel. In my case libpthread does not allocate a 10 Mb memory block, because the 10 processes should allocate 100Mb of memory Top does show only a sligth increase in memory . On my kubuntu there are 145 processes allocated . So i can not reproduce your problem. Regards Wim. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Scanlines again
On Sat, 05 Jan 2008 19:14:51 + Dominique Louis [EMAIL PROTECTED] wrote: Firstly, I'd like to propose a slight change to the scanlines example so that it is easier for developers to follow the code and to possibly incorporate bits of it into their own code. type TBGRA = packed record b, g, r, a : byte; end; PBGRA = ^TBGRA; TBGRAArray = array[ WORD ] of TBGRA; PBGRAArray = ^TBGRAArray; procedure TForm1.PaintToRGB32bitScanLine(Row, ImgWidth: integer; LineStart: Pointer); // LineStart is pointer to the start of a scanline with the following format: // 4 bytes per pixel. First byte is blue, second green, third is red. // the fourth byte is the Alpha value, which is not specified in this // example // Black is 0,0,0, white is 255,255,255 var i: Integer; lrow : PBGRAArray begin lrow := PBGRAArray( LineStart ) // fill line with gray for i := 0 to ImgWidth - 1 do begin lrow^[ i ].r := 128; // set red to 128 lrow^[ i ].g := 128; // set green to 128 lrow^[ i ].b := 128; // set blue to 128 end; // set one diagonal pixel to red ( this creates a diagonal red line ) lrow^[ ( Row mod ImgWidth ) ].r := 255; // set red to 255 - full intensity lrow^[ ( Row mod ImgWidth ) ].g := 0; // set green to 0 lrow^[ ( Row mod ImgWidth ) ].b := 0; // set blue to 0 end; I think this is a lot easier to understand than the previous version. Ok. Can you create a patch? Secondly, I have a scanline issue that I hope someone on here can help with. I have 2 TImages on a Form ( I'm using Mac OS X if that makes any difference ) one contains an image of a yellow light bulb. I want to copy, pixel by pixel, the image from one TImage over to the second TImage. Yes I know I could just assign the bitmap from one to the other, but this is an exercise in Scanline manipulation. The problem I have is that once copied the second TImage contains a blue light bulb instead of a yellow one. The code I'm using is.. MyBitmap := TBitmap.Create; ScanLineImage := Image1.Picture.Bitmap.CreateIntfImage; MyBitmap.Width := ScanLineImage.Width; MyBitmap.Height:= ScanLineImage.Height; IntfImage := MyBitmap.CreateIntfImage; ImgFormatDescription.Init_BPP32_B8G8R8_BIO_TTB( ScanLineImage.Width, ScanLineImage.Height ); IntfImage.DataDescrption := ImgFormatDescription; for y := 0 to ScanLineImage.Height do Height-1 begin lrow := ScanLineImage.GetDataLineStart( y ); brow := IntfImage.GetDataLineStart( y ); What's brow? for x := 0 to ScanLineImage.Width do Width-1 begin brow^[ x ].r := lrow^[ x ].r; // set red brow^[ x ].g := lrow^[ x ].g; // set green brow^[ x ].b := lrow^[ x ].b; // set blue brow^[ x ].a := lrow^[ x ].a; // set alpha value end; end; MyBitmap.LoadFromIntfImage( IntfImage ); Image2.Picture.Bitmap := MyBitmap; Can anyone see a flaw in my logic of using scanlines for this/this way? Yes. MyBitmap.LoadFromIntfImage( IntfImage ) does no conversion. You created an image with the format ImgFormatDescription.Init_BPP32_B8G8R8_BIO_TTB which is probably not the format of your platform. Solution: Don't use ScanLine, but use the Colors property of IntfImage. See the examples/lazintfimage/fadein1.lpi. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] accessing internal widgetset handle
Mattias Gaertner wrote: On Sun, 06 Jan 2008 01:13:52 +0700 Bee [EMAIL PROTECTED] wrote: Hi all, I'd like to create a gtk(2) app that has a non-rectangular form shape, using Lazarus of course. I know gtk(2) provides API for this purpose. The API requires a pointer to GTKWidget. But, I couldn't find any ways to get the widget pointer of Lazarus' form since Lazarus wraps the API very well inside LCL. Hints? TIA. BTW... which API should I use for this purpose, gtk or gdk? Both wrappers are provided in FPC/Lazarus and both provide similar API for the purpose. In term of Lazarus' LCL, what are the differences between both? Both gtk and gdk are available in the gtk interface. I don't know, which one you use for this. If you need the gtkwindow, then just type cast Form1.Handle: GtkWindow:=PGtkWindow(Form1.Handle); Beware, that this is an internal LCL gtk interface structure and can change in the future without warning. And it will. The right way to do it in laz 0.9.26 and up is: GtkWindow := PGtkWindget(SomeWincontrol.Reference.Ptr); This won't change. A Reference: TWSReference is the replacement for all handles used in the LCL. Unfortunately it is not yet implemented for TWincontrol, so for now you need to cast the handle. Marc If you find out how to do it, it would be nice to write a small example and describe it on the wiki. Eventually this feature could be added to the LCL. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] accessing internal widgetset handle
Am Sonntag, den 06.01.2008, 01:13 +0700 schrieb Bee: BTW... which API should I use for this purpose, gtk or gdk? Both wrappers are provided in FPC/Lazarus and both provide similar API for the purpose. In term of Lazarus' LCL, what are the differences between both? Normally I'd tend to use gdk, but I'm not sure (it's been a whilesince I fiddled with that directly ...). You could look at some GTK/GDK docs and tutorials or ask on their mailing list. ( should be gtk-app-devel-list at gnome dot org ) HTH, Marc _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Making GTK Thread Safe
willem wrote: well I made 10 copy's of threadbug and run them in parallel. In my case libpthread does not allocate a 10 Mb memory block, because the 10 processes should allocate 100Mb of memory Top does show only a sligth increase in memory . On my kubuntu there are 145 processes allocated . So i can not reproduce your problem. I just tried on another distribution, and without WaitFor the leak is still there, but a lot smaller, only ~12kb per thread. Did you run with or without WaitFor? How big is the thread overhead? Thanks! -- Al _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives