r0x0r / pywebview

Build GUI for your Python program with JavaScript, HTML, and CSS
https://pywebview.flowrl.com
BSD 3-Clause "New" or "Revised" License
4.73k stars 554 forks source link

[GTK] Cash on multiple window open/clos #543

Closed Fizzadar closed 3 years ago

Fizzadar commented 4 years ago

Specification

Description

Application crashing when opening/closing a window over and over or in a short timeframe:

import webview

html = '<button onClick="pywebview.api.cycleWindows()">Click me!</button>'

WINDOWS = {}

class Api:
    def cycleWindows(self):
        other_window = WINDOWS.get('other')
        if other_window:
            other_window.destroy()

        # sleep(1)
        # WINDOWS['main'].evaluate_js('window.location.reload();')
        other = webview.create_window('windowyes', html='<h1>window</h1>', x=0, y=0)
        WINDOWS['other'] = other

if __name__ == '__main__':
    api = Api()
    window = webview.create_window('API example', html=html, js_api=api)
    WINDOWS['main'] = window
    webview.start()

This works fine on Mac/Cocoa, but pressing the button repeatedly when using GTK/Linux causes a segfault almost immediately. If you enable the 1s sleep before reloading the problem goes away. Am going to continue investigating this!

Practicalities

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Ksengine commented 4 years ago

web dont want to fix it

r0x0r commented 3 years ago

@Fizzadar
I could not reproduce it with the latest pygojbect on Ubuntu 20.04.1

Fizzadar commented 3 years ago

@r0x0r thank you for checking - also cannot reproduce on the latest versions/Ubuntu20 👍