Recent

Author Topic: Form graphics corruption?  (Read 7025 times)

Murmandamus

  • New member
  • *
  • Posts: 8
Form graphics corruption?
« on: December 04, 2012, 08:33:29 pm »
I looked around a bit to see if this has been reported by others, but in the last few versions of Lazarus (from about 0.9.29 onwards), I am getting a strange graphics corruption bug in both the IDE and in compiled apps.

What happens is this: I bring up a form, for example, the Install/Uninstall Packages form, and it appears just fine. Then I wave the mouse pointer over the form and some random amount of waving later, some areas of the form are replaced by either contents from another window/form, like the Object Inspector window, or from the window underneath the form. Here are a couple examples:

Normal Package dialog form
Corrupted with image data from the source editor and object inspector windows
Corrupted with image data from both the source editor, the form editor, and the object inspector windows

It is almost like it is using the wrong repaint buffer for the particular window. I do nothing but wave the mouse pointer over the window. No clicking, no pressing keys, nothing.

Has anyone seen this before and know how to fix it?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11463
  • Debugger - SynEdit - and more
    • wiki
Re: Form graphics corruption?
« Reply #1 on: December 04, 2012, 08:55:13 pm »
What OS are you using? Looks like windows, but which windows? 32 or 64 bit?
What gfx card, what resolution, color depth?

And, 09.29 is outdated by now. 1.0.4 is the latest release.

Murmandamus

  • New member
  • *
  • Posts: 8
Re: Form graphics corruption?
« Reply #2 on: December 04, 2012, 09:13:08 pm »
Windows XP 32-bit, ATI Radeon 4870, 32 bpp.

Pretty bog-standard setup.

Yes, I am aware that 0.9.29 is pretty old. I indicated that was when I first noticed the problem, and it has been a problem ever since that version in the versions I have used up until 1.0.2, which is what I have now.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11463
  • Debugger - SynEdit - and more
    • wiki
Re: Form graphics corruption?
« Reply #3 on: December 04, 2012, 09:35:58 pm »
There is on other case, but that is on a windows 98. That reports has been around match longer.

Problem is, if no-one can reproduce it, then it is extremely hard to fix.

One thing would be to find the revision in which it first happened. Sometimes that can give a hint. But it is a lot of work, and can only be done on a PC on which it happens. (yours)

Also it may be an issue with reaching a resource limit. Then that wont help. Lazarus uses a lot of resources (though some other apps to do), that may even trigger bugs in gfx drivers (I am not saying it does, but it is possible. ANd even if it is in combination with the gfx driver, it is 50/50 whos fault it is.).
Have you updated yours? Can you?
Or start windows in safe mode, and see if it happens?


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11463
  • Debugger - SynEdit - and more
    • wiki
Re: Form graphics corruption?
« Reply #4 on: December 05, 2012, 05:44:05 pm »
Also can you try with and without manifest? (In an app that you created yourself / see project options)

Is there a minimum number of components needed, or is it only specific components? e.g. does it happen with a form and 2 labels and nothing else?

Murmandamus

  • New member
  • *
  • Posts: 8
Re: Form graphics corruption?
« Reply #5 on: December 14, 2012, 02:16:11 am »
Apologies for the late reply, internet has been out here for the better part of a week. Lousy DSL provider (Windstream).

It happens just launching lazarus and nothing else, with the default new project. I've gone through several display driver revisions since I first noticed it, so if it is a graphics driver bug, it is a persistent one. I can try it in safe mode, but I will try some twiddling first to see if I can find a case where it can be caused with regularity. It really looks like a window repaint buffer problem.

Kinda surprised no one else has seen it, but like you say, that probably means it is something unique to my system/setup.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11463
  • Debugger - SynEdit - and more
    • wiki
Re: Form graphics corruption?
« Reply #6 on: December 15, 2012, 05:36:13 am »
I found the entry in mantis. A very similar, if not the same issue. This windows ME: http://bugs.freepascal.org/view.php?id=13062

A 2nd person (Bernd) commented having seen it on
Quote
Windows 98 version. Never on Windows 2000 and never on Windows XP.

And Paul has seen it on 98

Makes 4 people now.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11463
  • Debugger - SynEdit - and more
    • wiki
Re: Form graphics corruption?
« Reply #7 on: December 15, 2012, 05:48:07 am »
Another think you might try:

open   lcl\interfaces\win32\win32callback.inc
line 400

Code: [Select]
    // check if double buffering is requested
    useDoubleBuffer := (ControlDC = 0) and (lWinControl.DoubleBuffered or ThemeServices.ThemesEnabled);
    if useDoubleBuffer then

Insert the line  "  useDoubleBuffer := False;" as follows

Code: [Select]
    // check if double buffering is requested
    useDoubleBuffer := (ControlDC = 0) and (lWinControl.DoubleBuffered or ThemeServices.ThemesEnabled);
    useDoubleBuffer := False;
    if useDoubleBuffer then



Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11463
  • Debugger - SynEdit - and more
    • wiki
Re: Form graphics corruption?
« Reply #8 on: December 17, 2012, 03:52:01 pm »
Please compile with the following 2 defined
DBG_SendPaintMessage
DEBUG_DOUBLEBUFFER

then run with --debug-log=C:\logfile.txt

This can have serious slow down effect on painting. You might be able to see each element being painted. If it is to slow, use DBG_SendPaintMessage only.

Keep a backup, of your previous lazarus.exe.

Whenever you close the IDE delete the file if nothing had happened. The file will grow fast.

When the issue occurs: immediately minimize the entire IDE. Doing so, move the mouse outside the IDE as much as possible. (This is the quickest way to stop further msg of being added to the file)
Then compress the file (it will be huge, if you cut out lines from the start, keep at least the last 10.000 lines)

Attach the compressed file

Murmandamus

  • New member
  • *
  • Posts: 8
Re: Form graphics corruption?
« Reply #9 on: June 28, 2014, 12:18:57 am »
Apologies for necroing my own thread, but I figure it is better to keep context rather than starting over.

I have been doing more console app-type programming in the time since I posted this issue, so it hasn't been on the front burner for a bit. I also figured that it might have gotten solved by now, but apparently it still is a problem which plagues my LCL GUI applications. It is worse as ever.. seems like every form in Lazarus 1.2.2 (which I am using now) as well as the ones I make has this issue, and it happens fairly immediately when I just move the mouse pointer over controls in the window.

I have been researching some of the LCL source code (specifically win32callback.inc, as mentioned by Martin), but it appears I need to study the entire bottom end of the LCL win32 platform-specific codebase to see if I can narrow down the issue. I think Martin was on the right track with it likely being related to an edge case in the double-buffering, as that is what it looks like. It almost seems like it is either accidentally using dirty buffers, or not  passing the correct ones up and down the component event chain.

I will try to do the message debugging as suggested in the next week and reply back with the results as soon as I am able.

Again, apologies for letting it hang out here so long; realities of RL projects and life situations sometimes get in the way of the best intentions. :-/ Regardless, I REALLY want to find and fix this bug -- it has been a plague for me for a long time.

 

TinyPortal © 2005-2018