stretchly icon indicating copy to clipboard operation
stretchly copied to clipboard

Crash if hit Ctrl-X just when Stretchly message appears

Open rob-stewart opened this issue 2 years ago • 6 comments

I use an editor (Emacs) for which typing Ctrl-X is common. On numerous occasions, I've happened to hit Ctrl-X just when Stretchly begins to pop up on the screen. When that happens, Stretchly crashes. Here's info from Event Viewer:

[-](https://github.com/hovancik/stretchly/issues/new#) <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
[-](https://github.com/hovancik/stretchly/issues/new#) <System>
  <Provider Name="Application Error" /> 
  <EventID Qualifiers="0">1000</EventID> 
  <Version>0</Version> 
  <Level>2</Level> 
  <Task>100</Task> 
  <Opcode>0</Opcode> 
  <Keywords>0x80000000000000</Keywords> 
  <TimeCreated SystemTime="2022-09-14T21:12:22.9992379Z" /> 
  <EventRecordID>10688</EventRecordID> 
  <Correlation /> 
  <Execution ProcessID="0" ThreadID="0" /> 
  <Channel>Application</Channel> 
  <Computer>album131bal.ds.susq.com</Computer> 
  <Security /> 
  </System>
[-](https://github.com/hovancik/stretchly/issues/new#) <EventData>
  <Data>Stretchly.exe</Data> 
  <Data>1.11.0.0</Data> 
  <Data>62eaa47d</Data> 
  <Data>Stretchly.exe</Data> 
  <Data>1.11.0.0</Data> 
  <Data>62eaa47d</Data> 
  <Data>c0000005</Data> 
  <Data>00000000032b1d32</Data> 
  <Data>1668</Data> 
  <Data>01d8c69a5ddda760</Data> 
  <Data>C:\Users\...\AppData\Local\Programs\stretchly\Stretchly.exe</Data> 
  <Data>C:\Users\...\AppData\Local\Programs\stretchly\Stretchly.exe</Data> 
  <Data>bde08b83-e5e0-4c2b-aac4-8bae401370c9</Data> 
  <Data /> 
  <Data /> 
  </EventData>
  </Event>

This happened with earlier versions, too.

Presumably, something isn't initialized by the time the Ctrl-X handler is invoked.

rob-stewart avatar Sep 14 '22 21:09 rob-stewart

Could you please paste the logs? https://github.com/hovancik/stretchly#debugging

hovancik avatar Sep 17 '22 08:09 hovancik

Sorry. I missed your request for logs. The error just happened again, so I've included the tail of the log, including the restart after the crash: [2023-01-10 14:15:55.529] [info] Stretchly: showing window 1 of 2 [2023-01-10 14:15:55.531] [info] Stretchly: starting Mini Break [2023-01-10 14:15:55.655] [info] Stretchly: finishing Mini Break (shouldPlanNext: true) [2023-01-10 14:15:55.663] [info] Stretchly: showing window 2 of 2 [2023-01-10 14:15:55.672] [error] TypeError: Cannot read properties of null (reading 'center') at Timeout._onTimeout (C:\Users\stewart\AppData\Local\Programs\stretchly\resources\app.asar\main.js:741:30) at listOnTimeout (node:internal/timers:559:17) at process.processTimers (node:internal/timers:502:7) [2023-01-10 14:17:31.066] [info] Stretchly: initializing... [2023-01-10 14:17:31.082] [info] Stretchly: loading preferences [2023-01-10 14:17:31.093] [info] Stretchly: starting Idle time monitoring [2023-01-10 14:17:31.094] [info] Stretchly: starting Do Not Disturb monitoring [2023-01-10 14:17:31.185] [info] Stretchly: loading default break ideas [2023-01-10 14:17:31.222] [info] Stretchly: loading default break ideas [2023-01-10 14:17:32.756] [info] Stretchly: checking for new version (local: v1.12.0, remote: 1.13.1)

rob-stewart avatar Jan 10 '23 19:01 rob-stewart

I confirm this bug. Version 1.13.1. Below are the log events for the latest crash:

[2023-02-20 16:00:08.182] [info] Stretchly: finishing Long Break (shouldPlanNext: true)

[2023-02-20 16:09:58.201] [info] Stretchly: showing Mini Break notification [2023-02-20 16:10:09.162] [info] Stretchly: showing window 1 of 3 [2023-02-20 16:10:09.165] [info] Stretchly: starting Mini Break [2023-02-20 16:10:10.373] [info] Stretchly: showing window 2 of 3 [2023-02-20 16:10:11.533] [info] Stretchly: postponing Mini Break [2023-02-20 16:10:11.577] [info] Stretchly: showing window 3 of 3 [2023-02-20 16:10:11.703] [error] TypeError: Cannot read properties of null (reading 'center') at Timeout._onTimeout (C:\Users\nlv13464\AppData\Local\Programs\Stretchly\resources\app.asar\main.js:756:30) at listOnTimeout (node:internal/timers:559:17) at process.processTimers (node:internal/timers:502:7)

Note that I have multiple screens. Typically, it takes some time to display the notification on all screens.

pkoster avatar Feb 21 '23 11:02 pkoster

Got while working with Notepad++.

231103_191410_Stretchly_Stretchly

[2023-11-03 19:13:48.296] [info]  Stretchly: showing Mini Break notification
[2023-11-03 19:13:58.804] [info]  Stretchly: showing window 1 of 3
[2023-11-03 19:13:58.805] [info]  Stretchly: starting Mini Break
[2023-11-03 19:13:58.816] [info]  Stretchly: showing window 2 of 3
[2023-11-03 19:14:00.612] [info]  Stretchly: postponing Mini Break
[2023-11-03 19:14:04.287] [info]  Stretchly: showing window 3 of 3
[2023-11-03 19:14:04.333] [error] TypeError: Cannot read properties of null (reading 'center')
    at Timeout._onTimeout (C:\Users\user\AppData\Local\Programs\Stretchly\resources\app.asar\main.js:752:30)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)

unwave avatar Nov 03 '23 16:11 unwave

FYI, this continues to happen, albeit much more rarely now. I'm currently running 1.14.1 and will upgrade to 1.15.1, but it doesn't appear there were any changes in that version to address this issue.

As I mentioned previously, being able to configure the dismiss shortcut would go a long way toward addressing this issue. For me, Ctrl+X is extremely common. For Windows users, Ctrl+X is the Cut shortcut, so it will be reasonably common for any Windows user. Being able to choose another shortcut means selecting something less common in one's daily workflow.

Obviously, there are exceptions being raised that could be handled near the time you're trying to display the window(s). Even if it means setting a flag indicating you're trying to render the window(s), which can tell the exception handler to ignore exceptions you might otherwise want to handle differently. Clearing the flag once you finish rendering the windows, or a second later if you don't know when they finish rendering, would resume normal exception handling.

rob-stewart avatar Nov 20 '23 15:11 rob-stewart

Hi, sorry for not replying.

Editing shortcut is possible: https://github.com/hovancik/stretchly?tab=readme-ov-file#postponefinish-break-shortcut

This issue happens because loading of some windows has not finished and they are closed already by shortcut. I guess I could make a change that the shortcut is available only after let's say 3 seconds. Or when all windows are done with loading: Will have to check if that is possible with how the code operates right now.

hovancik avatar Feb 17 '24 14:02 hovancik