racket / drracket

DrRacket, IDE for Racket
http://www.racket-lang.org/
Other
447 stars 94 forks source link

DrRacket starts up and opens a *.rkt file, but not the 2nd *.rkt file from File Explorer (Windows 10) #456

Closed formalizm closed 2 years ago

formalizm commented 3 years ago

I've upgraded Racket from 7.7 to 7.9 (default, not CS version) and I get this problem. I'm using Windows 10.

When DrRacket is not running and I start a .rkt file from File Explorer or similar, it starts up normally and shows the file. So, the association of .rkt with DrRacket is OK.

However, after DrRacket is already started and running, any other *.rkt file triggered via File Explorer does not work, DrRacket does not open another tab. (While it opens files OK via File -> Open menu).

I'm not sure how to diagnose the problem. I've tried the menu View -> Show Log and enabled all debug messages, but I don't see anything relevant there when I try to open a new file.

formalizm commented 3 years ago

I've downgraded to 7.8 - the same issue, the 2nd file is not opening. Then I've downgraded to 7.7, the issue is gone, files are opening normally. Hence, this issue was introduced with version 7.8.

jackfirth commented 3 years ago

Seems like this issue would be better in the racket/drracket repository, but I don't have the permissions needed to transfer the issue. Could someone else transfer this issue?

rfindler commented 3 years ago

It is probably an issue in the racket/gui layer, technically (but it seems fine to leave the issue here until we know for sure).

shhyou commented 3 years ago

Looks like this is also reported as racket/gui#200 and racket/gui#139.

default-kramer commented 3 years ago

For what it's worth, I just upgraded from 7.9 to an 8.x snapshot, specifically version 8.0.0.11--2021-03-15(c0cfd32/a), and I'm very happy to see this is fixed now.

I think the specific error in racket/gui#139 has been fixed since 2019, so I closed that one.

I think this issue and racket/gui#200 are recently fixed with 8.0.

MrYossu commented 3 years ago

@default-kramer I'm using 8.1 and have the same problem, so it doesn't look like it's been fixed.

formalizm commented 3 years ago

The issue is still present in 8.2.

default-kramer commented 2 years ago

Just upgraded from my snapshot to 8.2 and was reminded of this bug. The following summary might be useful for someone who tries to fix this (and that someone might be me, in a short while)

default-kramer commented 2 years ago

Did a little bit of investigation today. The file https://github.com/racket/drracket/blob/master/drracket/drracket/drracket.rkt seemed to be the entry point of DrRacket, but it is not. I added a println near the top and both 7.7 and 8.2 printed it the first time they opened a file, but not when the 2nd file was requested. As expected, 7.7 worked and 8.2 did not.

A little more exploring found the -singleInstance option. Found do-single-instance/gtk in https://github.com/racket/gui/blob/master/gui-lib/mred/private/wx/gtk/unique.rkt and followed it to the application-file-handler which is the mechanism used to pass the command-line arguments to the primary single instance. Following that leads to this line https://github.com/racket/drracket/blob/64ebab6ff74f7cf30e9922be8929aa04c5a187ff/drracket/drracket/private/main.rkt#L56 where DrRacket installs its own application-file-handler. Confirmed that 7.7 does handle "open the 2nd file" via this mechanism, but in 8.2 the application-file-handler is never called.

I was was able to create a minimal repro of the root cause: https://github.com/racket/gui/issues/245

default-kramer commented 2 years ago

Looks like the fix for https://github.com/racket/gui/issues/245 worked and this bug is no longer present in 8.3! Can anyone else confirm? Then we can close this issue and https://github.com/racket/gui/issues/200

formalizm commented 2 years ago

I do confirm. The issue is fixed with DrRacket 8.3. I've checked it on the same machine as this issue was reported (win10).