Permalink
Browse files

Make WaitForInitialized instead initialize on-demand

  • Loading branch information...
1 parent 02569b4 commit 6c8b4ee88bffe133483d14dec28357446e533d72 @paulcbetts committed Feb 20, 2012
Showing with 10 additions and 8 deletions.
  1. +10 −8 CefSharp/CefWpfWebBrowser.cpp
@@ -186,23 +186,25 @@ namespace CefSharp
void CefWpfWebBrowser::WaitForInitialized()
{
- if (IsInitialized) return;
+ //if (IsInitialized) return;
- // TODO: risk of infinite lock
- //_browserInitialized->WaitOne();
- }
-
- void CefWpfWebBrowser::OnApplyTemplate()
- {
if (_address == nullptr)
{
Visual^ parent = (Visual^)VisualTreeHelper::GetParent(this);
- HwndSource^ source = (HwndSource^)PresentationSource::FromVisual(parent);
+ if (parent == nullptr)
+ {
+ return;
+ }
+ HwndSource^ source = (HwndSource^)PresentationSource::FromVisual(parent);
Setup(source, "about:blank");
}
+ }
+ void CefWpfWebBrowser::OnApplyTemplate()
+ {
ContentControl::OnApplyTemplate();
+ WaitForInitialized();
_image = (Image^)GetTemplateChild("PART_Image");

0 comments on commit 6c8b4ee

Please sign in to comment.