Document-Archiver / com.sophisticatedapps.archiving.document-archiver

https://document-archiver.github.io/
Apache License 2.0
25 stars 4 forks source link

Freezing when launching external viewer on Linux #13

Closed Dansoftowner closed 3 years ago

Dansoftowner commented 3 years ago

Hi @stephansann ,

I tried Document Archiver on my Ubuntu machine. I experienced that the app freezes when I try to open the external editor for the particular file.

Screenshot

The funny thing is that no exception occurs.

Fortunately, I had the same problem with the java.awt.Desktop API in my application on Linux systems and now I know what is the solution. So basically you should execute the Desktop.getDesktop().open(...) command on an another thread. I used an ExecutorService:

ExecutorService executor = Executors.newCachedThreadPool(); // just an example
executor.submit(() -> Desktop.getDesktop().open(file));

Hope you find this report useful! Best regards Daniel

stephansann commented 3 years ago

Hi @Dansoftowner

Thanks a lot for the report.

Could you maybe share the file this is happening with?

Anyhow I will have a look at the code and change it as suggested.

Best regards Stephan

Dansoftowner commented 3 years ago

It happens with every file I tried, the problem is not with the files. It's basically a bug on linux, but somehow invoking the Desktop API method on another thread solves the problem.

stephansann commented 3 years ago

Hi @Dansoftowner

Seems to be okay now in the latest SNAPSHOT-build: https://repository.sophisticatedapps.com/snapshots/com/sophisticatedapps/archiving/document-archiver/2.1.0-SNAPSHOT/document-archiver-2.1.0-20210510.153821-2-linux.zip

Could you please have a look if okay for you, too?

Thanks Stephan

Dansoftowner commented 3 years ago

Hi @stephansann ,

Now it works fine! :)

Daniel

stephansann commented 3 years ago

Hi @Dansoftowner

Nice - happy to learn it works for you, too.

Thanks again for reporting and also for the suggested solution!

BR, Stephan