Author Topic: Question on sudden deaths of the program  (Read 3201 times)

0 Members and 1 Guest are viewing this topic.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Question on sudden deaths of the program
« on: November 20, 2020, 10:02:42 am »
Hi guys. I'm desperately looking for the cause of the program crash. Do you think that a short DO LOOP (30 lines) loop that inserts several virtual screens over each other without _LIMIT constraints could be the cause? There are no memory leaks, at the end of the loop there is _DISPLAY, the only thing that happens is multiple work with the image using MAPTRIANGLE 2D and PUTIMAGE. Does anyone have a tip? I don't even attach the source code, it's a big program over 3000 lines without a single English comment...

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Question on sudden deaths of the program
« Reply #1 on: November 20, 2020, 10:56:36 am »
I think I've had crashes with _PUTIMAGE when I mess up source or destination coordinates (but not handles). _LIMIT should make no difference present or not.

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Question on sudden deaths of the program
« Reply #2 on: November 20, 2020, 11:01:15 am »
Windows or Linux? I get the xlib thread crash quite often, seems graphics related

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Question on sudden deaths of the program
« Reply #3 on: November 20, 2020, 11:34:34 am »
It is in Windows 7. My program use LINE + _PUTIMAGE or MAPTRIANGLE + _PUTIMAGE.  LINE + _PUTIMAGE crash. I was now trying to simulate this defect with a simple example. I was in a hurry. So I put the NEWIMAGE statement (now) in the DO-LOOP loop. This resulted in a computer flooding and a forced restart. That's why I didn't answer you right away. Now I'm trying again and I can't do this bug again. Really... i dont know what is bad.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: Question on sudden deaths of the program
« Reply #4 on: November 20, 2020, 12:16:47 pm »
hi ! I used to have a similar problem with _putimage. I didn't understand the reason. Then I switched to _maptriangle and it got good. Alternatively, try to create a SUB called _PUTIMAGE2 and have the sub draw with maptriangles so you don't have to change the original code.


Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Question on sudden deaths of the program
« Reply #5 on: November 20, 2020, 12:40:51 pm »
hi ! I used to have a similar problem with _putimage. I didn't understand the reason. Then I switched to _maptriangle and it got good. Alternatively, try to create a SUB called _PUTIMAGE2 and have the sub draw with maptriangles so you don't have to change the original code.

You know, that just sounds like Rotozoom specially if you can scale x, y independently:
https://www.qb64.org/forum/index.php?topic=2313.msg115354#msg115354

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Question on sudden deaths of the program
« Reply #6 on: November 20, 2020, 12:49:25 pm »
That's a good idea, MasterGy. I'll probably do it that way, search it again (about 10x today) and look for a mistake. I tried LINE on an invalid handle, I try a loop without LIMIT constraint, I still try PUTIMAGE on an invalid handle .... what i do here is to create a drawing with the LINE command on the virtual screen and then place it with the _PUTIMAGE statement on another virtual screen. During this drawing on the virtual screen, this screen is cleaned by inserting the content of another virtual screen (there are 3 virtual screens in total) and the output of the virtual screen is projected by the _PUTIMAGE command to a reserved place on the visible screen. It's really weird that the concept works with MAPTRIANGLE but crashes with LINE. _DEST is used always correctly for LINE.

I find one missing _DEST, i test program again and then write here back, how is it now!
« Last Edit: November 20, 2020, 01:04:42 pm by Petr »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Question on sudden deaths of the program
« Reply #7 on: November 20, 2020, 01:18:30 pm »
So it hasn't fallen yet. Now it holds and works longer than before. It seems that before my repair was done,  _DEST changed during LINE work, and because _DEST was missing in one place before LINE, the program crashed. And very badly. There was nothing to catch. Windows before repair just wrote that the program stopped working - and Petr - search!
Now it works! Thank you all for your interest and help!