Opened 16 years ago
Closed 14 years ago
#1395 closed Bug (Fixed)
DLLCallbacks on Exit
| Reported by: | ProgAndy | Owned by: | trancexx |
|---|---|---|---|
| Milestone: | 3.3.9.1 | Component: | AutoIt |
| Version: | Other | Severity: | None |
| Keywords: | Cc: |
Description
I wish it would be possible to have DLLCllbacks persist longer in the destruction chain on script termination. At least it would be great to have them alive when objects are released. This would allow to implement the 'hooking into IDispatch' directly in AutoIt without errors and without CoCreateInstance. Therefore an Object::release-dllcallback is needed and up to now AutoIt crashes and fails to exit when there are such objects on termination. http://www.autoitscript.com/forum/index.php?showtopic=107678&view=findpost&p=759950
You can come around this by freeing the Object-Variable manually, but you can't do that on an AutoIt-Error like "Array out of bounds" or any other error on which Autoit is terminating without calling the ExitFuncs.
I don't know if this change is possible, but if it is this would be a great enhancement in favour of supporting objects.
PS: I think, this is related to tracid #1319
Attachments (2)
Change History (9)
comment:1 by , 16 years ago
| Version: | 3.3.3.1 |
|---|
comment:2 by , 16 years ago
Do you have an example that you'd like to see working without crashes (simple, please, and not related to #1319)? I need to see exactly what you're thinking to tell if it even makes sense from an object-lifetime standpoint. Also, I don't think that AutoIt should crash so I would like to fix that, at least, even if your request doesn't make sense from a lifetime standpoint.
comment:3 by , 16 years ago
Oh, sorry, Autoit IS calling the OnExitFuncs when "Array out of bounds" is shown, so the only thing remaining is exit without freeing the object. i will attach the shortest Object i could think of
by , 16 years ago
| Attachment: | LongerObjectWithProperty.au3 added |
|---|
just added a single property to the object, (the object is released on exit, uncomment OnAutoItExitUnregister to change)
comment:4 by , 16 years ago
I would really appreciate if this could be fixed.
ProgAndy's example is a bit complex, but the basic idea is this
Func Test()
EndFunc
$cb = DllCallbackRegister("Test","dword","")
$obj = ObjCreate("Shell.Application")
; There isn't such a member in Shell.Application, but it's the principle
$obj.CustomCleanup = DllCallbackGetPtr($cb)
The example would never exit since $cb would be cleared before $obj which means that when $obj is executing its cleanup it would try calling cb which is now not valid anymore.
comment:5 by , 14 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
| Type: | Feature Request → Bug |
This is bug. It's not related to lifetime of callbacks.
Code attempts to acces object (not com but internal) during its destruction.
Global variables are sometimes evil, like here.
comment:7 by , 14 years ago
| Milestone: | → 3.3.9.1 |
|---|---|
| Resolution: | → Fixed |
| Status: | assigned → closed |
Fixed by revision [6796] in version: 3.3.9.1

Automatic ticket cleanup.