microsoft / WindowsAppSDK-Samples

Feature samples for the Windows App SDK
MIT License
685 stars 217 forks source link

Samples\Windowing\cpp\cpp-winui custom title bar crash #329

Closed JamasChuang94 closed 1 month ago

JamasChuang94 commented 4 months ago

Select the titlebar twice and use the minimize and maximize buttons in the custom status bar to crash. The void* value{} in TitleBar() is empty.

In

void TitlebarPage::SetCustomTitleBarDragRegion()
   {
      int titleBarHeight = m_appWindow.TitleBar().Height(); 
    }

  template <typename D> auto consume_Microsoft_UI_Windowing_IAppWindow<D>::TitleBar() const
  {
      void* value{};//Empty
      check_hresult(WINRT_IMPL_SHIM(winrt::Microsoft::UI::Windowing::IAppWindow)->get_TitleBar(&value));// &value 0xFFFFFFFFFFFFFFFF 
      return winrt::Microsoft::UI::Windowing::AppWindowTitleBar{ value, take_ownership_from_abi };
  }

'SampleApp.exe' (Win32): 'C:\Windows\System32\ninput.dll' has been loaded. 'SampleApp.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.5_5001.70.1338.0_x64__8wekyb3d8bbwe\Microsoft.UI.Xaml.Phone.dll'. Natvis C++/WinRT: Exception in ... cppwinrt_visualizer::EvaluateVisualizedExpression Exception thrown at 0x00007FF6CFFF7645 (in SampleApp.exe): 0xC0000005: An access violation occurred while reading location 0xFFFFFFFFFFFFFFFF.