Click here to Skip to main content
15,887,596 members
Home / Discussions / C#
   

C#

 
AnswerRe: split issue Pin
Luc Pattyn13-Aug-10 2:08
sitebuilderLuc Pattyn13-Aug-10 2:08 
AnswerRe: split issue Pin
Ian Shlasko13-Aug-10 2:58
Ian Shlasko13-Aug-10 2:58 
GeneralRe: split issue Pin
Luc Pattyn13-Aug-10 3:38
sitebuilderLuc Pattyn13-Aug-10 3:38 
GeneralRe: split issue Pin
Ian Shlasko13-Aug-10 4:25
Ian Shlasko13-Aug-10 4:25 
QuestionUnmanaged callback, Dispose issue Pin
DaveyM6912-Aug-10 23:04
professionalDaveyM6912-Aug-10 23:04 
AnswerRe: Unmanaged callback, Dispose issue Pin
Luc Pattyn13-Aug-10 1:51
sitebuilderLuc Pattyn13-Aug-10 1:51 
GeneralRe: Unmanaged callback, Dispose issue Pin
DaveyM6913-Aug-10 2:17
professionalDaveyM6913-Aug-10 2:17 
AnswerRe: Unmanaged callback, Dispose issue Pin
Luc Pattyn13-Aug-10 2:46
sitebuilderLuc Pattyn13-Aug-10 2:46 
You probably need to split each of those objects X into two managed objects:
- XFunctionality gets exposed to the user and takes care of real functionality;
- XUnmanagedResource, hidden from the user, deals with the management of the unmanaged resource only.

Obviously XFunctionality would create its XUnmanagedResource instance and keep a reference to it, probably when you call an Open(). The callback method however would be part of XFunctionality, so the XUnmanagedResource finalizer can cause it to be called even after XUnmanagedResource has died.

And XFunctionality would also contain a static List<XFunctionality> holding all live XFunctionality instances preventing any of them being collected without being closed first; the close-callback should then remove its XFunctionality object from that collection, making it collectible. And you could provide a static CloseAll() method enforcing all of the remaining ones to be closed.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.


GeneralRe: Unmanaged callback, Dispose issue Pin
DaveyM6913-Aug-10 4:35
professionalDaveyM6913-Aug-10 4:35 
GeneralRe: Unmanaged callback, Dispose issue Pin
DaveyM6914-Aug-10 8:30
professionalDaveyM6914-Aug-10 8:30 
GeneralRe: Unmanaged callback, Dispose issue Pin
Luc Pattyn14-Aug-10 8:43
sitebuilderLuc Pattyn14-Aug-10 8:43 
GeneralRe: Unmanaged callback, Dispose issue Pin
DaveyM6914-Aug-10 9:07
professionalDaveyM6914-Aug-10 9:07 
GeneralRe: Unmanaged callback, Dispose issue Pin
Luc Pattyn14-Aug-10 9:19
sitebuilderLuc Pattyn14-Aug-10 9:19 
GeneralRe: Unmanaged callback, Dispose issue Pin
DaveyM6914-Aug-10 9:31
professionalDaveyM6914-Aug-10 9:31 
Questionhow to session value in a page. Pin
Mubeen.asim12-Aug-10 21:38
Mubeen.asim12-Aug-10 21:38 
AnswerRe: how to session value in a page. Pin
Jens Meyer12-Aug-10 22:10
Jens Meyer12-Aug-10 22:10 
GeneralRe: how to session value in a page. Pin
Mubeen.asim12-Aug-10 23:17
Mubeen.asim12-Aug-10 23:17 
QuestionResize problem for drawn rectangle on the picture box? Pin
Nivas8212-Aug-10 20:27
Nivas8212-Aug-10 20:27 
AnswerRe: Resize problem for drawn rectangle on the picture box? Pin
Luc Pattyn13-Aug-10 2:05
sitebuilderLuc Pattyn13-Aug-10 2:05 
GeneralRe: Resize problem for drawn rectangle on the picture box? Pin
Nivas8217-Aug-10 20:30
Nivas8217-Aug-10 20:30 
GeneralRe: Resize problem for drawn rectangle on the picture box? Pin
Luc Pattyn18-Aug-10 1:41
sitebuilderLuc Pattyn18-Aug-10 1:41 
GeneralRe: Resize problem for drawn rectangle on the picture box? Pin
Nivas8223-Aug-10 2:12
Nivas8223-Aug-10 2:12 
AnswerRe: Resize problem for drawn rectangle on the picture box? Pin
Luc Pattyn23-Aug-10 2:16
sitebuilderLuc Pattyn23-Aug-10 2:16 
GeneralRe: Resize problem for drawn rectangle on the picture box? Pin
Nivas8223-Aug-10 23:09
Nivas8223-Aug-10 23:09 
GeneralRe: Resize problem for drawn rectangle on the picture box? Pin
Nivas8220-Oct-10 21:30
Nivas8220-Oct-10 21:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.