LxP Posted December 4, 2005 Posted December 4, 2005 Hi all, This code causes AutoIt v3.1.1.92 to hard-crash: Local $Struct = DLLStructCreate('Int') DLLStructDelete($Struct) DLLStructGetData($Struct, 1) Would the way that AutoIt handles this be regarded as a bug given that theoretically it could be coded to avoid a hard-crash?
jpm Posted December 4, 2005 Posted December 4, 2005 Hi all, This code causes AutoIt v3.1.1.92 to hard-crash: Local $Struct = DLLStructCreate('Int') DLLStructDelete($Struct) DLLStructGetData($Struct, 1) Would the way that AutoIt handles this be regarded as a bug given that theoretically it could be coded to avoid a hard-crash?I was just looking at this DLLStruct... code and I found out that DLLStructDelete cannot work as AutoIt is design. None AutoIt function can destroy a variable pass as a parameter to an internal Autoit function. I.E. DLLStructDelete($Struct) cannot destroy $Struct which is the intention. to have it working $Struct msut be something similar to FileOpen/FileClose. So the quick answer is an Autoit Crash is bug and to Avoid it $Struct=0 should be use instead of DLLStructDelete($Struct) if you are for sure no Window function is still referencing the created Data. Just to illustrate that DLLStructDelete is not working just check the return value of a second DLLStructDelete just after the first one you will see that it say OK instead of returning and error as stated in the doc. I will work on this bug. The easiest solution being remove the DllStructDelete function
LxP Posted December 4, 2005 Author Posted December 4, 2005 FileOpen() and FileClose() use 'pseudo'-pointers if I understand correctly, i.e. a number with a special meaning to AutoIt is returned in the variable. When a file operation is subsequently requested, AutoIt compares this special number to 'its own records' to find the real Windows file handle etc.Perhaps the same thing could be done with DLLStructCreate()?
jpm Posted December 4, 2005 Posted December 4, 2005 FileOpen() and FileClose() use 'pseudo'-pointers if I understand correctly, i.e. a number with a special meaning to AutoIt is returned in the variable. When a file operation is subsequently requested, AutoIt compares this special number to 'its own records' to find the real Windows file handle etc.Perhaps the same thing could be done with DLLStructCreate()?Yes a lot of change with certainly a limitation on number of DLLStruct that can be created or simply removed DLLStructDelete and change the doc to say that to release resources you just nedd to do $Struct=0 as for com object.I think I prefer this last solution as DLLStruct is still in beta. Recreating a new DllStruct on an old one will deleted the old one. it already works this way in the current beta release.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now