Results 1 to 7 of 7

Thread: Help with debugging a conversion

  1. #1

    Help with debugging a conversion

    Ok, I'm going snow-blind trying to find my mistake. A while back I wrote a simple little pixelart editor and decided to convert it over to Lazarus so I can use it on my Mac, Linux, and PC systems.

    All was going well until I decided to "optimize" the graphics by creating my own layered image support. This works a treat and is MUCH faster then using per pixel manip via the LCL.

    The problem is when I try and load an existing image from my HD using TPicture, TGraphic, TBitmap, whatever it all goes across the gap and I get errors in strange places.

    This leads me to believe that I've screwed up and am either overriding memory some place, or have a memory leak some place that isn't so obvious.

    If anyone can look at the source and tell me where/what I'm doing wrong I'd really appreciate it.

    Download http://www.eonclash.com/PGD/ImageEditor.zip

    PS: This is only the start of the conversion, lots more work to be completed before I'm done. I know the code is a mess and once I have this part working I'm going to start cleaning it up. This requires a version of Lazarus that has "frame" support to compile.

  2. #2

    Help with debugging a conversion

    Hi Jeremy :-)
    I tried running the .exe and then opening up a .png file - I straight away got an access violation.

    Is this one of the bugs you mean?

    Also what version of Lazarus do I need...I have 0.9.26 beta installed.

    It has errors about unknown properties when opening the project.

    cheers,
    Paul

  3. #3

    Help with debugging a conversion

    Lazarus 0.9.27 beta here
    As far as I can see, it seems something related to layer size. When loading a new image, TImageLayer.Resize is called, but NewWidth and NewHeight are 0, so you get an error in the fillchar call.

    Just an advice: when debugging a project in Lazarus, it is useful to activate code checks (Project->Compiler options->Code->Checks[-Ci, -Cr, -Co, -Ct, -CR]) and debug infos (Project->Compiler options->Linking->Debugging[-g, -gl]), that in your project are disabled. With debug infos you can step over your code, so it is easier to debug
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  4. #4

    Help with debugging a conversion

    Paul, that's exactly the problem I'm having. Though at times I can open a pic just fine and others won't open at all. Size doesn't seem to matter much, as one run I can open one, and on another run I can't.

    I get an error when the code tries to release the TPicture instance after I draw its TGraphic onto my temp PNG in LoadFrom. It just doesn't make any sense as the same code in another application works just fine.

    I'm beginning to wonder if this has something to do with the frames and a memory problem. Guess I should try it without the frames and see what happens.

    Legolas, I've tried that. Problem is the error comes from so deep in the system that the lazarus debugger only shows me the assembly window. A call stack trace shows no known lines of code. I've tried stepping down with F7 to the problem but it moves every few runs. I'm leaning more and more towards memory leak or problem with frames.

  5. #5

    Help with debugging a conversion

    Hi Legolas,
    Perhaps this is a "dumb question (tm)", but where do I get Lazarus 0.9.27 beta from?

    The downloads only have 0.9.26 available...

    cheers,
    Paul

  6. #6

    Help with debugging a conversion

    Why you download the Daily Snapshot and prey it works: http://snapshots.lazarus.shikami.org/lazarus/

    Or you can use the same version I'm on: http://www.eonclash.com/PGD/Lazarus-...0120-win32.exe

    That's the latest Daily that compiles and actually works that I've found LOL

  7. #7

    Help with debugging a conversion

    Quote Originally Posted by jdarling
    Why you download the Daily Snapshot and prey it works: http://snapshots.lazarus.shikami.org/lazarus/

    Or you can use the same version I'm on: http://www.eonclash.com/PGD/Lazarus-...0120-win32.exe

    That's the latest Daily that compiles and actually works that I've found LOL
    I like that, download and pray that it works!! lol

    Thanks, I will download the exe and try it
    cheers,
    Paul

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •