hoffstadt / DearPyGui

Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
https://dearpygui.readthedocs.io/en/latest/
MIT License
13.2k stars 687 forks source link

Bug: add_file_dialog segfault on ubuntu #1074

Open DrDrwx opened 3 years ago

DrDrwx commented 3 years ago

Version of Dear PyGui

Version: DPG 0.8.38 Operating System: 5.4.0-77-generic #86~18.04.1-Ubuntu SMP Fri Jun 18 01:23:22 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux, Ubuntu 18.04.5 LTS

Python 3.8.0 (default, Feb 25 2021, 22:10:10), [GCC 8.4.0] on linux

Bug

DPG SegFaults when clicking the username/user home button along the top, within the file explorer widget. In this instance, drwx.

To Reproduce

Steps to reproduce the behavior:

  1. Run provided code
  2. Click on your username "drwx", in my screenshot.
  3. Segfault?

Expected behavior

Expected behaviour was for the window to display files within my home directory.

Screenshots/Video

image

Standalone, minimal, complete and verifiable example

import dearpygui.dearpygui as dpg

with dpg.window():
    dpg.add_file_dialog()
dpg.start_dearpygui()
Mstpyt commented 3 years ago

Can Confirm that everything works fine on Windows.

hoffstadt commented 3 years ago

So this only happens if your user name is file permissions? lol

DrDrwx commented 3 years ago

Apparently? I'm not too sure, just seems broken for me lmao

christuart commented 3 years ago

I can reproduce this. My username for testing was cstuart. For me it wasn't just with my own username - any file dialog started in a subdirectory of /home// will segfault when I click on that second directory button.

Version: 0.8.64 on Python 3.7 Operating System: Scientific Linux 7.4

Segfault will happen even if I have used other directory buttons in between (e.g. start in /home/abc/def/ghi/jkl and click ghi followed by abc: segfault). Segfault will happen even if I have used the directory listing to move into another directory (e.g. start in /home/abc/def, move into /home/abc/def/ghi, click abc and it crashes). Segfault will happen even if the first directory name is /solhome not /home. I also get a segfault if I start in /home/abc/def/, click 'home' at the top and then click abc in the directory listing. I also get a segfault if I start in /home/ and then click abc in the directory listing.

Segfault didn't happen however if I started in /etc/systemd/system and clicked systemd.

I have a suspicion it is related to crossing filesystems? I'm not exactly sure though, since some other mounted drives on my system didn't produce the segfault. I do often find myself in folders that don't work (nothing is marked as [file] or [dir] so I can't navigate into the directories. The obvious place this happens for me is when I navigate to '/'. I assume this is a different bug but I haven't got round to reporting that yet.

Useful example if you want to test out lots of different starting folders:

from pathlib import Path
import dearpygui.dearpygui as dpg

with dpg.window() as window_id:

    dpg.set_primary_window(window_id, True)

    starting_file_item = dpg.add_input_text(label='File dialog starting file', default_value=Path().absolute())

    # Add a button to create a file dialog
    def callback():
        starting_path = Path(dpg.get_value(starting_file_item))
        if starting_path.is_dir(): starting_path /= 'foobar'
        with dpg.file_dialog(
            directory_selector=False,
            show=True,
            default_path=str(starting_path.parent),
            default_filename=starting_path.name,
        ):
            dpg.add_file_extension("")
    dpg.add_button(label='Open file dialog', callback=callback)

dpg.start_dearpygui()
hoffstadt commented 3 years ago

Can we verify this is occuring in 1.0?