Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,14 @@ class _CustomPlatformViewState extends State<CustomPlatformView>
_reportSurfaceSize();
_reportWidgetPosition();

if (!_focusNode.hasFocus) {
_focusNode.requestFocus();
Future.delayed(const Duration(milliseconds: 50), () {
if (!_focusNode.hasFocus) {
_focusNode.requestFocus();
}
});
}
// if (!_focusNode.hasFocus) {
// _focusNode.requestFocus();
// Future.delayed(const Duration(milliseconds: 50), () {
// if (!_focusNode.hasFocus) {
// _focusNode.requestFocus();
// }
// });
// }

_pointerKind = ev.kind;
if (ev.kind == PointerDeviceKind.touch) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ namespace flutter_inappwebview_plugin
valid_ = true;
}

GraphicsContext::~GraphicsContext()
{
// Explicitly release DirectX resources to prevent hanging process
if (device_context_) {
device_context_->ClearState();
device_context_->Flush();
device_context_ = nullptr;
}

device_winrt_ = nullptr;
device_ = nullptr;
valid_ = false;
}

winrt::com_ptr<ABI::Windows::UI::Composition::ICompositor>
GraphicsContext::CreateCompositor()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace flutter_inappwebview_plugin
class GraphicsContext {
public:
GraphicsContext(rx::RoHelper* rohelper);
~GraphicsContext();

inline bool IsValid() const { return valid_; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,26 @@ namespace flutter_inappwebview_plugin
keepAliveWebViews.clear();
windowWebViews.clear();
UnregisterClass(windowClass_.lpszClassName, nullptr);

// Properly cleanup static DirectX resources to prevent hanging process
if (compositor_) {
// Release the extra reference we added in constructor
compositor_->Release();
compositor_ = nullptr;
}

// Reset graphics context to release DirectX resources
graphics_context_.reset();

// Cleanup dispatcher queue controller
if (dispatcher_queue_controller_) {
dispatcher_queue_controller_ = nullptr;
}

// Reset RoHelper
rohelper_.reset();

valid_ = false;
plugin = nullptr;
}
}