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:
https://github.com/elixir-desktop/desktop

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 113008 - chromium - An open-source project to help move the web forward. - Monorail 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:

PS: I have added bakeware (GitHub - bake-bake-bake/bakeware: Compile Elixir applications into single, easily distributed executable binaries) 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:

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

Tee
can someone please explain to me how Enum.reduce works with maps
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
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
Mooodi
Given a string, how can I get access to its character by index? Enum.at("my_string", 2) doesn't work. Or rather, not char, but a substr...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
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
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
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

We're in Beta

About us Mission Statement