Looking for someone to help on BLIde

Community Forums/Developer Stations/Looking for someone to help on BLIde

ziggy(Posted 2006) [#1]
I'm looking for some good C# programer to help on BLIde. There's a GDI eating-resources bug that's driveing me absolutely crazy. If some wants to lend a hand, it will be more than welcome.

Thanks.


Boiled Sweets(Posted 2006) [#2]
Email me. I'm one exam away from obtaining my MCAD in C# so I'm pretty experienced, having coded a mixture of C, COBOL, VB, C# for over 15 years.


ziggy(Posted 2006) [#3]
You can download the SyntaxBox source used by BLIde here:
http://www.blide.org/syntaxboxsource.zip

there's also a sample application. This application creates a form with a button. If you press the button a lot of forms are created and destroyed, but If you look to the Dispose method in the SyntaxBox source, you see a console trace whould be displayed when the control is erased, but this message never displays, so there's a bug or memory leak somewhere.

The GDI issue has been fixed, but I think there is another bug, as some users are experiencing coding problems (code getting mangled). I can't find this bug. Please, if someone find it, let me know it. I can give you more information about how the control works, just email me for any question or whatever.

Thanks in advance


PetBom(Posted 2006) [#4]
I just took a quick look at the code. It seems your worry is that the dispose() method of the SyntaxBoxControl.cs is never called. Well, it is!

The reason why your trace statement is not displayed is because an error(?...or you're doing something i do not understand) in the code:
		#region DISPOSE()

		/// <summary>
		/// </summary>
		/// <param name="disposing"></param>
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (components != null)
					components.Dispose();
			}
			base.Dispose(disposing);
		}
        ~SyntaxBoxControl()
		{
#if DEBUG
			try
			{
				Console.WriteLine("finalizing syntaxbox");
			}
			catch
			{
			}
#endif
		}
		#endregion //END DISPOSE


I would do it like this:
		#region DISPOSE()

		/// <summary>
		/// </summary>
		/// <param name="disposing"></param>
		protected override void Dispose(bool disposing)
		{

#if DEBUG
            try
            {
                Console.WriteLine("finalizing syntaxbox");
            }
            catch
            {
            }
#endif

			if (disposing)
			{
				if (components != null)
					components.Dispose();
			}
			base.Dispose(disposing);
		}

		#endregion //END DISPOSE


Since the syntaxbox code is regarded as unmanaged by your TestApp you cannot use the debugger directly. Edit the properties for the "Puzzle.SyntaxBox.NET 2.0 project". Check "Enable unmanaged code debugging" under the "Debug" tab. This should allow you to debug that code using breakpoints and stepping inside the "Puzzle.SyntaxBox.NET 2.0 project". That way you should be able to easily see what happens and that you are disposing everything you need to dispose.

I might take a deeper look later, but I really haven't got the time right now.

Hope that helps some...


ziggy(Posted 2006) [#5]
Many thanks, but this ~ operator indicates the destructor method, it is called everywhere in all child controls without any error. Also removing the #if and #end if directives the text is not shown.
also doint this:
		#region DISPOSE()

		/// <summary>
		/// </summary>
		/// <param name="disposing"></param>
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (components != null)
					components.Dispose();
			}
			base.Dispose(disposing);
Console.WriteLine("finalizing syntaxbox");

		}

the text is never displayed. I think there must be a cross referencing issue somewhere.


PetBom(Posted 2006) [#6]
With my example code and unmanaged debugging turned on the text is written to the console! I just tested it. The method is called.

I also tested inserting a breakpoint and caught the dispose call. I stepped all the way down to the dispose method on the base Form control and all seems fine.

You mentioned earlier that you thought that it was a GDI problem, but that you ruled that out. But there are a number of known disposning problems within GDI. So maybe the problem is there after all?


PetBom(Posted 2006) [#7]
I looked through the Painter_GDI.cs class and found this suspicios row in the RenderRow(Graphics g, int RowIndex, int RowPos) method:

[783] e.Graphics = Graphics.FromHdc(bbuff.hDC);

This object is passed around a bit, but I can't find anywhere that the object is disposed.


ziggy(Posted 2006) [#8]
The Renderrow is called from the RenderAll that calls RenderAll2. RenderAll generates the Graphics object, and destroys it at the end (Or it should destroy it)


PetBom(Posted 2006) [#9]
Yeah, I found the disposing of that object.

The only other funky thing that I found was that the WeakTimer (wich is one of the items in the components collection of the SyntaxBox object) does not seem to implement the IDispose interface, yet the component collection tries to kill its children with .Dispose(). Subsequently the destructor for the WeakTimer is never hit.


ziggy(Posted 2006) [#10]
I've fixed this one.
I've fixed A LOT of little GDI issues in the rendering routines and I think I have a 100% GDI stable version (I've done A LOT of testings, and no errors antill now).
I've found also some missing Dispose commands in the syntaxdocument control, and in the Painter routines.

I will have another BETA available today :) lalalala
I'm very happy.
:D

thanks a lot PetBom.

EDIT: New beta avilabe, chech the BlitzMax Programing thread.