Some kind of deadlock in Control::SetParentHandle

From: Kenny Carruthers (ken_at_kennyc.com)
Date: 03/26/04


Date: Thu, 25 Mar 2004 16:26:47 -0800


    Just wondering if someone could shed some light on what might be causing
the following problem:

    I have a main window that is an MdiContainer. There is a "Windows" menu
that I populate myself and handle the events.
The problem is that every once in awhile, my application deadlocks when the
user selects a window from the menu and
the application tries to show() it. The code for showing it does nothing for
then look through an ArrayList of windows, finds the one
matching name, then calls:

    (Handle in a basic menu_click event handler in the MDI Parent form)

    window.MdiParent = this;
    window.Show();

    Right after the Show(), the application freezes. If I "Pause" it in the
debugger at this state, the CallStack
is the following:

system.windows.forms.dll!System.Windows.Forms.Control::SetParentHandle
system.windows.forms.dll!System.Windows.Forms.Control::CreateControl
system.windows.forms.dll!System.Windows.Forms.Control::CreateControl
system.windows.forms.dll!System.Windows.Forms.Control::WmShowWindow
system.windows.forms.dll!System.Windows.Forms.Control::WndProc
system.windows.forms.dll!System.Windows.Forms.ScrollableControl::WndProc
system.windows.forms.dll!System.Windows.Forms.ContainerControl::WndProc
system.windows.forms.dll!System.Windows.Forms.Form::WmShowWindow
system.windows.forms.dll!System.Windows.Forms.Form::WndProc
system.windows.forms.dll!ControlNativeWindow::OnMessage
system.windows.forms.dll!ControlNativeWindow::WndProc
system.windows.forms.dll!System.Windows.Forms.NativeWindow::DebuggableCallba
ck
system.windows.forms.dll!System.Windows.Forms.UnsafeNativeMethods::CreateWin
dowEx
system.windows.forms.dll!System.Windows.Forms.NativeWindow::CreateHandle
system.windows.forms.dll!System.Windows.Forms.Control::CreateHandle
system.windows.forms.dll!System.Windows.Forms.Form::CreateHandle
system.windows.forms.dll!System.Windows.Forms.Control::get_Handle
system.windows.forms.dll!System.Windows.Forms.Form::SetVisibleCore
system.windows.forms.dll!System.Windows.Forms.Control::set_Visible
system.windows.forms.dll!System.Windows.Forms.Control::Show()
EPro.exe!D2Pro.MainWindow.WindowsContainerMenuItem_Click

    There's nothing fancy going on when I show this window that I can see
would cause a deadlock in my code.
The only thing that I can think of, is that one of the controls in the
window being show'n makes some InterOp
calls in its OnPaint() routine and uses the handle to the device context for
calling a few routines. Could this be causing the
call stack above?

    Since this doesn't happen all the time, it's proving to be pretty
challenging to track down. Any help would be appreciated.

Thank you,
Kenny



Relevant Pages

  • Re: IE crashes frequently on XP
    ... Just to be sure that the machine is malware free: ... Then look at any programs that might be causing a problem with IE. Look at ... The progression of symptoms is always identical. ... > symptoms as the first window. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Deleting Objects Using VBA
    ... causing your problem or not. ... delete quite a number of various objects (such as tables, queries, forms, ... Each Routine for each Group ... not all Forms (same applies for some Reports and som Tables) are ...
    (microsoft.public.access.modulesdaovba)
  • Re: odd behaviour of Outlook 2003
    ... So what is causing this, and why does it not happen on the laptop? ... window can only be removed by refreshing the desktop. ... If I copy the pst file to the laptop it works ... Kate B ...
    (microsoft.public.outlook)
  • Re: Strange new window popping up on my Thinkpad under XP Pro
    ... Also, on closing, the window that pops up says: ... Setting up personalized settings for: ... I get an error window saying something to the effect: ... install XP SP3 and it crashed, could that be causing the problems? ...
    (microsoft.public.windowsxp.newusers)
  • Re: File error: data may have been lost
    ... my MacBookPro w/OSX 10.5.2 and Office 12.0.1, this bug is causing my computer ... to crash. ... if i try to press the green "maximize window" button in the upper left corner ... No help here about the Excel freeze, rather for the Force Quit. ...
    (microsoft.public.mac.office.excel)