Fl4m3Ph03n1x

Fl4m3Ph03n1x

Failed to unregister class Chrome_WidgetWin_0. Error = 203

Background

I am using Elixir Desktop (by @dominicletz ) to make an elixir desktop application:

And I am successfully able to launch and manage my app. However, when I close it I always get this error:

[1224/050609.437:ERROR:window_impl.cc(115)] Failed to unregister class Chrome_WidgetWin_0. Error = 203

Animation

Problems

There are actually two issues here

  1. The application takes a very long time to close after I press Quit. The message is received by Phoenix (see the I AM LEAVING log) but for some reason the window takes several seconds to close.
  2. I get the previously mentioned error

Code

At this point 90% of this HelloWorld project is code generated by mix. There are only 2 files I changes that might be relevant here:

menubar.ex

defmodule WebInterface.MenuBar do
  @moduledoc """
    Menubar that is shown as part of the main Window on Windows/Linux. In
    MacOS this Menubar appears at the very top of the screen.
  """
  import WebInterface.Gettext
  use Desktop.Menu
  alias Desktop.Window

  @impl Desktop.Menu
  def render(assigns) do
    ~H"""
    <menubar>
      <menu label={gettext("File")}>
          <hr/>
          <item onclick="quit"><%= gettext "Quit" %></item>
      </menu>
      <menu label={gettext("Extra")}>
          <item onclick="browser"><%= gettext "Open Browser" %></item>
      </menu>
    </menubar>
    """
  end

  @impl Desktop.Menu
  def handle_event("quit", menu) do
    IO.puts("I AM LEAVING")
    Window.quit()
    {:noreply, menu}
  end

  def handle_event("browser", menu) do
    WebInterface.Endpoint.url()
    |> Window.prepare_url()
    |> :wx_misc.launchDefaultBrowser()

    {:noreply, menu}
  end

  @impl Desktop.Menu
  def mount(menu) do
    {:ok, menu}
  end

  @impl Desktop.Menu
  def handle_info(:changed, menu) do
    {:noreply, menu}
  end
end

applications.ex

defmodule WebInterface.Application do
  # See https://hexdocs.pm/elixir/Application.html
  # for more information on OTP Applications
  @moduledoc false

  use Application

    alias Desktop

  @impl true
  def start(_type, _args) do
    children = [
      WebInterface.Telemetry,
      {Phoenix.PubSub, name: WebInterface.PubSub},
      WebInterface.Endpoint,
      {Desktop.Window,
       [
         app: :web_interface,
         id: WebInterface,
         title: "Web Interface",
         size: {600, 500},
         menubar: WebInterface.MenuBar,
         url: &WebInterface.Endpoint.url/0
       ]}
    ]

    opts = [strategy: :one_for_one, name: WebInterface.Supervisor]
    Supervisor.start_link(children, opts)
  end

  @impl true
  def config_change(changed, _new, removed) do
    WebInterface.Endpoint.config_change(changed, removed)
    :ok
  end
end

I am hoping this error is caused by either a miss configuration or some function I am not implementing correctly.

How can I fix this error?

Marked As Solved

dominicletz

dominicletz

Creator of Elixir Desktop

So in 1) it’s closing immediately but in 2) it just crashes? I’ll check what’s going on there.

Unfortunately the error message is coming directly from chrome https://bugs.chromium.org/p/chromium/issues/detail?id=113008 and is a know open issue. I don’t see an immediate way to get rid of it.

Also Liked

dominicletz

dominicletz

Creator of Elixir Desktop

I’ve definitely seen this before but thought it to be something in my app. Thanks for this minimal example. I’ll have a look into this sometime next week

Fl4m3Ph03n1x

Fl4m3Ph03n1x

For convience’s sake, here is the MWE app:
https://github.com/Fl4m3Ph03n1x/market_manager/tree/remake

PS: I have added bakeware (GitHub - bake-bake-bake/bakeware: Compile Elixir applications into single, easily distributed executable binaries · GitHub) to the app. It is optional, but it replicates the issue in the exe file, so I think it can be a good point of reference as well.

And thank you for having a look at this!

The only thing I found was this old post for 2016:
https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/4759

Not sure what to do with it to be honest, specially when I don’t even have Chrome on my VM, I only use Firefox.

Fl4m3Ph03n1x

Fl4m3Ph03n1x

@dominicletz Hey there, did you have some time to check the application out? If there is something I can do to help (that fits my limited ability within this domain) please do share!

Where Next?

Popular in Questions Top

skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
yawaramin
In the Dialyzer docs ( dialyzer — OTP 29.0.2 (dialyzer 6.0.1) ), there is a way to turn off a specific warning for a function: -dialyzer...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41539 114
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39297 209
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New

We're in Beta

About us Mission Statement