Debugger is too exact

Just starting out? Need help? Post your questions and find answers here.
Tomio
Enthusiast
Enthusiast
Posts: 291
Joined: Sun Apr 27, 2003 4:54 pm
Location: Germany

Debugger is too exact

Post by Tomio »

a problem I stumble across regularly:

As an example:

leaving the program by a common end-routine, I stop/shut/close... things which still could be open, even if they are not open,

e.g. "StopDrawing()":

No problem without Debugger.

But with Debugger enabled, the Debugger stops the run immediatly if there was no "StartDrawing()" preceding. Additional code is not executed.

Is there a way around?

../tomio
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Tomio,

If you fail to include StopDrawing() then terrible, terrible things will happen.

The debugger is doing you a great favour. Whatever happens, always make sure that StopDrawing is called.
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

GedB wrote:If you fail to include StopDrawing() then terrible, terrible things will happen.

The debugger is doing you a great favour. Whatever happens, always make sure that StopDrawing is called.
You got it backwards. He does always call StopDrawing(), but this also includes times when StartDrawing() has been included.

Tomio, I don't think there is a way around this without keeping track of whether you have started drawing using a variable or something. I'd like to see the ability for the debugger to continue from it's execution point if you want, but currently when the debugger is activated you cannot do anything but exit the program :(
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

I don't think there's any need to call anything in particular when you close the program, I'd have thought purebasic takes care of it all itself. If you've been writing to files and have those open, it might be worth closing them, but other than that, I'd guess it was safe.
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Ooops. :oops:

Green Giant,

PB event takes care of the files.

The only thing I've found that doesn't get cleaned up automatically are ODBC database connections.
Tomio
Enthusiast
Enthusiast
Posts: 291
Joined: Sun Apr 27, 2003 4:54 pm
Location: Germany

Post by Tomio »

Thank's everybody.

> don't think there's any need to call anything in particular when you close the program

Hmm, my impression in the past was different, but obviously wrong.

I'll do a test and remove all those cleanup.
If trouble comes up, I'll add a message.

../tomio
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

The one thing that doesn't get cleaned up is StopDrawing. That really has to be called whenever StartDrawing is used.

It is best to use small tight Drawing blocks, rather than calling it just once for the whole program.
TIGER
User
User
Posts: 81
Joined: Mon Feb 23, 2004 8:33 pm

Post by TIGER »

Its a programmer obligation to close everuthing
when the programm ends.

Free memory, images , close files . e.t.c

If you dont do that in PB maybe no problem (still its incorect)
If you dont do that in VB or C++ you got problems.
PIII450 128RAM TNT2
Post Reply