Modify

Opened 9 years ago

Closed 7 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)

NoExitWithCusomObject.au3 (3.7 KB) - added by ProgAndy 9 years ago.
a reproducer script for the error.
LongerObjectWithProperty.au3 (5.7 KB) - added by ProgAndy 9 years ago.
just added a single property to the object, (the object is released on exit, uncomment OnAutoItExitUnregister to change)

Download all attachments as: .zip

Change History (9)

comment:1 Changed 9 years ago by TicketCleanup

  • Version 3.3.3.1 deleted

Automatic ticket cleanup.

comment:2 Changed 9 years ago by Valik

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 Changed 9 years ago by ProgAndy

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

Changed 9 years ago by ProgAndy

a reproducer script for the error.

Changed 9 years ago by ProgAndy

just added a single property to the object, (the object is released on exit, uncomment OnAutoItExitUnregister to change)

comment:4 Changed 9 years ago by monoceres

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 Changed 7 years ago by trancexx

  • Owner set to trancexx
  • Status changed from new to assigned
  • Type changed from Feature Request to 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:6 Changed 7 years ago by TicketCleanup

  • Version set to Other

Automatic ticket cleanup.

comment:7 Changed 7 years ago by trancexx

  • Milestone set to 3.3.9.1
  • Resolution set to Fixed
  • Status changed from assigned to closed

Fixed by revision [6796] in version: 3.3.9.1

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain trancexx.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.