just_playback icon indicating copy to clipboard operation
just_playback copied to clipboard

App crash when using specific Windows utilities

Open JavideSs opened this issue 1 year ago • 4 comments

Hi, I tried just_playback and it worked! But I have a problem integrating it with my app.

When there is an instruction where a specific Windows component is used, it crashes. Can't open tkinter filedialog, application freezes. Also, my module ported from c++ to use the Taskbar Thumbnail Toolbar causes the application to terminate when the ThumbBarSetImageList() function is called.

Working on Windows 10 with Python 3.10.

Example

from just_playback import Playback
from tkinter import filedialog
playback = Playback()
playback.load_file('music-files/sample.mp3')
playback.play()
filedialog.askdirectory(title="Select folder")

JavideSs avatar Feb 25 '23 01:02 JavideSs

The sample code runs fine on my Linux machine.

This seems to be a problem with tkinter on Windows as discussed here and here. Try issuing all calls on the Playback object in a separate thread.

cheofusi avatar Feb 25 '23 22:02 cheofusi

It isn't an interface freeze error. The tkinter app works fine. Crash when there is a call to a particular windows utility. Maybe a bad interaction with a dll.

Windows 10,11. In linux works fine.

from just_playback import Playback
from tkinter import filedialog
playback = Playback() #removing this initialization the problem disappears
filedialog.askdirectory(title="Select folder") #not shown, crash
print("not executed")

No problem with a new thread. I don't know why it works, but it's not the right way

JavideSs avatar Feb 26 '23 00:02 JavideSs

No problem with a new thread. I don't know why it works, but it's not the right way

So it does work in a separate thread? And if it does why do you feel it's not right?

cheofusi avatar Feb 26 '23 06:02 cheofusi

It worked with the pygame.mixer module without the need for a new thread. The tkinter app works fine, it even plays songs with just_playback and everything works fine. Except when I use filedialog() or Taskbar Thumbnail Toolbar in Windows. A non-blocking call such as Playback() should not crash specific functions. I can't do ctrl+c to terminate the example program.

JavideSs avatar Feb 26 '23 18:02 JavideSs