robhagemans / pcbasic

PC-BASIC - A free, cross-platform emulator for the GW-BASIC family of interpreters
http://www.pc-basic.org
Other
397 stars 48 forks source link

crash on launching #142

Closed Theruler76-jr closed 2 years ago

Theruler76-jr commented 3 years ago

Bug report

Problem upon launching pcbasic.exe or pcbasicw.exe it crashes instantly

Crash log C:\Program Files (x86)\PC-BASIC 2.0>pcbasic [19:04:05.0078] ERROR: Fatal error in interface [19:04:05.0081] ERROR: Traceback (most recent call last): File "pcbasic\interface\interface.py", line 72, in launch File "pcbasic\interface\interface.py", line 95, in run File "pcbasic\interface\video.py", line 46, in cycle File "pcbasic\interface\video_sdl2.py", line 557, in _check_input File "pcbasic\interface\video_sdl2.py", line 652, in _handle_mouse_motion AttributeError: 'NoneType' object has no attribute 'active'

Notes

PC-BASIC version: 2.0.3 Operating system version: win 10 x64

It happens with my two intel graphic laptops (HP and DELL) no problems on other recent machines.

Danitegue commented 3 years ago

Hello, I'm having the same issue. I just installed python 3.9.7 (32bits), into C:\Python39 directory. then I ran "py -3 -m pip install pcbasic". It was installed properly. If I open the C:\Python39\Scripts\pcbasic.exe -> it gives problems randomly, sometimes yes and sometimes not. If I open it with argument "--interface=sld12 and --logfile=test.txt", I could catch this error in the logfile:

[14:54:47.0116] WARNING: Value "interface=sd12" ignored; should be one of (, none, cli, text, graphical, ansi, curses, pygame, sdl2) [14:54:47.0261] DEBUG: Failed to load font unifont with height 8: fonts/unifont_08.hex [14:54:47.0262] DEBUG: Failed to load font univga with height 8: fonts/univga_08.hex [14:54:47.0264] DEBUG: Failed to load font unifont with height 14: fonts/unifont_14.hex [14:54:47.0264] DEBUG: Failed to load font univga with height 14: fonts/univga_14.hex [14:54:47.0954] DEBUG: Opened file b'#3046DA9' as #0 (type b'ABP', mode b'I') [14:54:48.0452] ERROR: Fatal error in interface [14:54:48.0614] ERROR: Traceback (most recent call last): File "C:\Python39\lib\site-packages\pcbasic\interface\interface.py", line 72, in launch self.run() File "C:\Python39\lib\site-packages\pcbasic\interface\interface.py", line 95, in run self._video.cycle() File "C:\Python39\lib\site-packages\pcbasic\interface\video.py", line 46, in cycle self._check_input() File "C:\Python39\lib\site-packages\pcbasic\interface\video_sdl2.py", line 557, in _check_input self._event_handlersevent.type File "C:\Python39\lib\site-packages\pcbasic\interface\video_sdl2.py", line 652, in _handle_mouse_motion if self._clipboard_interface.active(): AttributeError: 'NoneType' object has no attribute 'active'

Marrin commented 3 years ago

@Danitegue There is some discrepancy with the alleged command line argument (sld12) and the log message (sd12). And both are not sdl2. That's three letters S, D, and L in lower case and the digit 2.

Danitegue commented 3 years ago

Yes, sorry my copy and paste fault after several tries. But I have tested again, and the problem persist even with the correct argument ("interface=sdl2" instead of "sd12" or "sld12"). When it is not understood the interface argument, it tries to load the sdl2 library as well. And then the clipboard problem happens randomly. Sometimes yes, and sometimes not... cannot understand.

robhagemans commented 3 years ago

Definitely a bug, thanks for reporting & sharing the stack trace. Looks like the mouse handler's _clipboard_interface member gets assigned None somewhere, which either shouldn't happen or should be accounted for in _handle_mouse_motion

rbergen commented 3 years ago

I ran into this while trying to figure out what's behind #136, and I think the issue is that in certain circumstances _check_input is called before the screen mode is set. This is relevant because it's in set_mode where _clipboard_interface is initialized. Currently, _check_input bails out if _display isn't set; it probably should check for set_mode having been called at least once, too. In fact, I've locally added this to video_sdl2.py, which did solve the problem for me. I'll open a PR to suggest adding this to the develop branch, shortly.

Theruler76-jr commented 3 years ago

I was able to replicate the bug. The crash occurs when the mouse pointer lies in the area where the PCBASIC window will appear. If I start the program while the mouse is outside, no crash occurs.

Hope this helps. Regards

robhagemans commented 2 years ago

Fixed on develop by commit f48a0e559, thanks @rbergen !