dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Mystery of the Modeless Dialog

Threaded View

  1. #1
    Join Date
    Mar 2001
    Posts
    2,527

    Mystery of the Modeless Dialog

    I am looking at some code similar to this. I have theories as to
    why the destructor is never called. In my opinion, the dialog does go
    out of scope...the manager object should automatically delete it.
    Code:
    void ShowSearchDialog(void)
    {
      uniqe_ptr<CModeLess> m_pmodeless(new CModeLess(this)); 
      m_pmodeless->Create(CModeLess::IDD);
      m_pmodeless->ShowWindow(SW_SHOW);	
    }
    In the dialog, based on some query results certain controls are disabled.

    The next time the function is called the same controls are disabled even
    if the query did not return the state that causes the controls to be disabled
    again.

    #1 Why doesn't the destructor get called?
    #2 Why is the object hanging around?
    #3 Why does the same object appear to be
    reconnecting to the pointer on subsequent calls?
    Last edited by ahoodin; April 10th, 2016 at 08:37 PM.
    ahoodin
    To keep the plot moving, that's why.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)