isl-org / isl-org/Open3D

Multiple windows do not work under Windows

Open
#5,771 2 comments 0 reactions 0 assignees View on GitHub
bug windows
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### Describe the issue

Applications opening additional rendering windows do crash when running under MS Windows 10.
The new window appears but the application is frozen for some time, i.e. you cannot move the application windows, neither the new window nor the original app window. After a short time all Open3D windows completely disappear. There is no error message in the command window from which the application was started. It's just back at the command prompt.

I've tested this with Python 3.10.9 and Open3D 0.16 as well as the latest development version 0.16.1+9ca1c11 and also with Python 3.9.6 and Open3D 0.15.1

There is no problem when running under Linux, i.e. Ubuntu 22.04 in my case.

The problem shows when running the demo example 'multiple_windows.py' and also with my own application that is creating additional windows on button click.

In my application I was able to almost workaround the problem by creating the new window in a function that I explicitely posted to the main user interface thread, i.e. instead of creating the window directly in the callback function of the button:
```
def _on_button_click(self):
# do some stuff
new_window = gui.Application.instance.create_window(title, width, height)
# do some more stuff
```
I did it in a function that I (re)posted to the main thread:

```
def _on_button_click(self):
# do some stuff
def launch_new_window():
new_window = gui.Application.instance.create_window(title, width, height)
# do some more stuff
gui.Application.instance.post_to_main_thread(self.window, launch_new_window)
```
This should not be required since the button callback is running in the main user interface thread. However, doing it this way the new window is shown and the application continues working. The only problem with this workaround is that the new window is empty until i move the mouse into it. I tried all kinds of things to trigger the window to draw its content immediately like `window.set_needs_layout()`, `window.post_redraw()` and even `widget3d.force_redraw()` without success. I have to move the mouse into the new window to display the user interface and geometry in it.

I thought the information above might be helpful to identify what causes this problem that seems to be special to running Open3D under MS Windows.

### Steps to reproduce the bug

```python
open3d example visualization/multiple_windows
```

### Error message

None

### Expected behavior

It should be possible to create additional windows within an Opem3D application running under MS Windows, the same way as it is possible to do it running under Linux.

### Open3D, Python and System information

```markdown
- Operating system: Windows 10 64-bit
- Python version: Python 3.10.9
- Open3D version: 0.16.1+9ca1c11
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip
```

### Additional information

None

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.