Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Code that crashes AHK_L x32



  • Please log in to reply
26 replies to this topic
guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011

There were no simultaneous Gdip_Startup() calls in my both scripts (one that works fine and one that was crashy). The block that starts with "If !pToken := Gdip_Startup()" got into my code just when I was uploading it to show it to you, my local version didn't have that block, but the crash still appeared.


ah, ok i see. then the problem might have been that you were calling Gdip_Shutdown() before you were really finished using the GDI+ functions. i'm not really sure.

in any case, i'm glad your issues are fixed and good luck in the future with your scripts happy.png

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

I assumed that from the beginning: the topic's name says that my code is crashing AHK process. My code. Not gdi+ or ahk.

 

Posting in the Issues forum implies you believe there to be an issue with AutoHotkey.  Your title does not convey your assumption.



iDrug
  • Members
  • 389 posts
  • Last active: Oct 11 2015 09:24 PM
  • Joined: 13 Oct 2009
guest3456,
but it works fine in a similar script. I already said that I haven't even touched a single line related to gdi+ since I re-wrote my old script. And the old script is still working fine.
At the same time - I do admit that I don't know gdi+ at all, and the code I'm using may have errors.

Lexikos,
I believed it was an issue with AHK until you dug up info about that crash. After that - I've changed my mind and marked that topic as "solved".
But to be fair I do think that a program shouldn't just crash at all, irregardless of what script it is running. It should have enough "foolproof" checks to define whether the code will lead to a stackoverflow/exception/whatever_else.

It's okay to quit with an error (especially if it's that informative that it can help you to define the reason of why it appeared (and thus you get 50% of it's solution)), but AHK doesn't show any informative errors: it just crashes with my code. So yeah, in general I think there's an issue with the AHK itself, I'm just not that demanding as to ask you to improve the error reporting system.

It was very nice of you to dig up to the reason of the crash, because I just haven't thought of looking up in event viewer.

You defined the reason of the crash for me -> I marked that topic as solved, the rest discussion here is just more about me asking concomitant questions that I had better ask in a different sub-forum (I do realize that, but I also hope I don't bother you much, since I already marked that topic as solved, which for me means that you may not answer any of my further questions).


Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

Given the nature of what you're doing, calling into an abitrary DLL where your script defines the API (correctly or not), some crashes are impossible to prevent.  The whole point of DllCall is that it allows scripts to call functions that AutoHotkey doesn't know about.  If AutoHotkey doesn't know what you're doing, it can't protect you from yourself.  There's also the fact that whatever goes on inside the DLL does is outside our control.

 

The best you could hope for would be for the program to catch exceptions at the highest level - display a generic error and exit when one is thrown.  That would be almost completely pointless, since Windows already does that.  Windows also logs some information to the event log which can be useful - information not readily available to the program afaik.

 

 

I believed it was an issue with AHK until you dug up info about that crash. 

 

So did you misspeak when you said that you assumed from the beginning that your code was the cause, not GDI+ or AHK?



iDrug
  • Members
  • 389 posts
  • Last active: Oct 11 2015 09:24 PM
  • Joined: 13 Oct 2009

So did you misspeak when you said that you assumed from the beginning that your code was the cause, not GDI+ or AHK?

Yes and no at the same time: obviously, it was my code that crashed the script, but since it worked fine earlier (the part that was changed - was about communicating with the server, not the GDI+ part) - I thought that there might also be instability inside of AHK itself. Every bug/crash is a conflict: two separate things may work perfectly well and may conflict if they are not separated. I didn't know where the conflict was.
Lexikos, I didn't write this post to find someone to blame - I did it to find out the real reason of the crash and to find the way to fix it. And with yours and guest3456's help I did so.

some crashes are impossible to prevent.

I didn't suggest to prevent that crash. I suggested to give more detailed info. Maybe it was just too stupid of me to not thing of event viewer, but you still could bring more comfort to the user if you 'taught' AHK to show that info in the text of the crash alert (if that's possible).

guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011

I didn't suggest to prevent that crash. I suggested to give more detailed info. Maybe it was just too stupid of me to not thing of event viewer, but you still could bring more comfort to the user if you 'taught' AHK to show that info in the text of the crash alert (if that's possible).


as lex said, more detailed info is usually displayed in the windows crash dialog, you can click on 'more info' (or something like that) and the box will expand and show information similar to what lex quoted in the solution post.

consider: a poorly coded DLL file that always crashes when its function is called. if you try to call this dll function within AHK, C++, C#, anything, the DLL will cause the crash. its impossible to intercept this. its hard to improve on lex's response

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

Yes and no at the same time

 

Either you misspoke or you didn't.

 

I didn't suggest to prevent that crash. I suggested to give more detailed info.  

 

A program which has crashed cannot do anything, such as displaying more detailed info.

 

 

 

as lex said, more detailed info is usually displayed in the windows crash dialog, you can click on 'more info' (or something like that) and the box will expand and show information similar to what lex quoted in the solution post.

 

I didn't say anything like that.  I said it displays a generic error message.  On my Windows 7 system, the only option I get is "Close program".



guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011
eh

PNA2Grn.png

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
You may note that I spoke only for my own system. You have error reporting enabled. I don't.

error.png

guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011
ah i've always had this, i didnt even know there was an option to turn it on/off.

gpsTao
  • Members
  • 11 posts
  • Last active:
  • Joined: 02 Oct 2012
Hello everybody.
 
Enjoying the topic, how I send more data than the image?
 
I would also send the id of the album, according to the API documentation of imgur: http://api.imgur.com/endpoints/image


Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
This thread and the Issues forum are not appropriate places for that question or its answer.

Try one of the imgur threads in the Scripts forum, or start a thread in Support.