ATL: Object deleted before window was destroyed 
Author Message
 ATL: Object deleted before window was destroyed

Salutation,

This is a continuation of my message of the 2/19/01.

I'm currently using a local server that manage a CWindowImpl. I have declare
the window as being a singleton (using DECLARE_CLASSFACTORY_SINGLETON) so
that there would only be one instance of the server at any time.

This at least allow me to share the window between different instance of the
ATL object.

I do have some issues. I can't create another window (since it already exist
m_hWnd != 0 ) and since the class is a singleton it will keep sharing the
same handle no matter what.  Also i get this assert when i close the share
window :

ATL: ERROR - Object deleted before window was destroyed

Which indicate that the CWindowImpl instance of the server gets deleted
before the window is properly released.

Is this because i force the window to be a singleton?

One solution i have right now is to use ::DestroyWindow() on the handle and
then set the m_hWnd of the CWindowImpl to 0 to avoid the second destruction
of the window. Don't know if that's very good to do.

Thank you in advance.

Francois Belair



Sat, 09 Aug 2003 23:53:44 GMT  
 ATL: Object deleted before window was destroyed


Fri, 19 Jun 1992 00:00:00 GMT  
 ATL: Object deleted before window was destroyed
CWindowImpl already has a DestroyWindow method.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:
> Salutation,

> This is a continuation of my message of the 2/19/01.

> I'm currently using a local server that manage a CWindowImpl. I have
declare
> the window as being a singleton (using DECLARE_CLASSFACTORY_SINGLETON) so
> that there would only be one instance of the server at any time.

> This at least allow me to share the window between different instance of
the
> ATL object.

> I do have some issues. I can't create another window (since it already
exist
> m_hWnd != 0 ) and since the class is a singleton it will keep sharing the
> same handle no matter what.  Also i get this assert when i close the share
> window :

> ATL: ERROR - Object deleted before window was destroyed

> Which indicate that the CWindowImpl instance of the server gets deleted
> before the window is properly released.

> Is this because i force the window to be a singleton?

> One solution i have right now is to use ::DestroyWindow() on the handle
and
> then set the m_hWnd of the CWindowImpl to 0 to avoid the second
destruction
> of the window. Don't know if that's very good to do.

> Thank you in advance.

> Francois Belair



Sun, 10 Aug 2003 12:32:14 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Problem in destroying ATL COM object

2. Problem when destroying window object

3. How to delete simple ATL object.

4. Changing/Deleting Methods in COM/ATL Objects

5. HOWTO set the property type of an ATL object to be another ATL object

6. Using a ATL Object in another ATL Object

7. Using a ATL Object in another ATL Object

8. Window object deleted during message handling

9. self-destroy or self-deleting software

10. How do I delete/destroy a toolbar?

11. ATL objects, with objects, with more objects

12. CAppBar window receives messages from destroyed window

 

 
Powered by phpBB® Forum Software