Skip to content

Commit 163fa12

Browse files
authored
Merge pull request #949 from hovancik/fix/memory-leak-break
Prevent memory leak when break ends
2 parents 3c633ba + 71997d7 commit 163fa12

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
8+
### Added
9+
- advanced preferences for Pause/Resume Breaks global shortcuts
10+
- advanced preferences for picking monitor to show break on
11+
- added initial support for the RTL languages for the UI
12+
13+
### Changed
14+
- endBreakShortcut can be set to empty string, thus disabled
15+
16+
### Fixed
17+
- prevent memory leak after break has ended
818

919
## [1.6.99] - 2021-05-02 Patreon
1020
### Added

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Please see http://electron.atom.io/docs/api/tray/ for Electron's Tray Linux spec
5050

5151
For Natural breaks, you might need some packages too (`libxss-dev`).
5252

53-
If *Stretchly* is not starting, you might need to run `sudo sysctl kernel.unprivileged_userns_clone=1`. Read more [here](https://github.com/electron/electron/issues/17972). Depending on your distro, you probably want to do something similar to this, so the settings are kept after reboot: Add `kernel.unprivileged_userns_clone=1` to `/etc/sysctl.d/00-local-userns.conf` and reboot.
53+
If *Stretchly* is not starting, you might need to run `sudo sysctl kernel.unprivileged_userns_clone=1`. Read more [here](https://github.com/electron/electron/issues/17972). Depending on your distro, you probably want to do something similar to this, so the preferences are kept after reboot: Add `kernel.unprivileged_userns_clone=1` to `/etc/sysctl.d/00-local-userns.conf` and reboot.
5454

5555
### Running from source
5656

@@ -62,7 +62,7 @@ You can create a custom installer by running `npm run pack` or `npm run dist` af
6262

6363
## Default behavior
6464

65-
When you run *Stretchly* for the first time, you are presented with a Welcome window that allows you to change the language, review the settings, view the online tutorial or simply continue with the default settings.
65+
When you run *Stretchly* for the first time, you are presented with a Welcome window that allows you to change the language, review the preferences, view the online tutorial or simply continue with the default preferences.
6666

6767
<img src="welcome.png" height="340">
6868

@@ -120,7 +120,9 @@ To make sure that all works as expected, it's always good idea to check that for
120120

121121
After you make changes to preferences files, some of the values being shown in Preferences or elsewhere might show incorect value, as the UI is expecting specific values and is not handling cases where user makes manual changes to preferences file.
122122

123-
Some of the extra settings are available in Contributor Preferences for [Contributors](#contributor-preferences). Those are marked by [![Contributor Preferences](https://img.shields.io/badge/Contributor_Preferences-✔-success)](#contributor-preferences) badge.
123+
Some of the extra preferences are available in Contributor Preferences for [Contributors](#contributor-preferences). Those are marked by [![Contributor Preferences](https://img.shields.io/badge/Contributor_Preferences-✔-success)](#contributor-preferences) badge.
124+
125+
Preferences marked with ![Not Reliable](https://img.shields.io/badge/Not_Reliable-β-yellow) might not work correctly and might break *Stretchly*. Use at own risk.
124126

125127
**Note:** Before 1.0, Mini Breaks and Long Breaks were called Microbreaks and Breaks, respectively. To keep the upgrade smooth they still use that name in preferences file and in code.
126128

@@ -136,7 +138,7 @@ In the preferences file, change `breakNotificationInterval: 30000,` to whatever
136138
#### Editing sunrise time to pause breaks until morning
137139
In the preferences file you can set the `morningHour` setting to pause until that hour today or the next day
138140
Otherwise, you can set `morningHour: "sunrise"` and set `posLatitude`, `posLongitude` in
139-
settings to pause until the actual sunrise in your area.
141+
preferences to pause until the actual sunrise in your area.
140142
E.g. if you live in Boston you would set:
141143
`morningHour: "sunrise",`
142144
`posLatitude: 42.3,`
@@ -187,7 +189,7 @@ To specify how solid the break window should be when Theme transparency is enabl
187189
#### Break window size [![Contributor Preferences](https://img.shields.io/badge/Contributor_Preferences-✔-success)](#contributor-preferences)
188190
To specify the size of the break window, set the value of `breakWindowHeight` and `breakWindowWidth` from `0` to `0.99` (which is in turn 0 to 99% of the size of the screen). Don't set 100% as that's fullscreen.
189191

190-
#### Make Stretchly show breaks as regular windows [![Contributor Preferences](https://img.shields.io/badge/Contributor_Preferences-✔-success)](#contributor-preferences)
192+
#### Make Stretchly show breaks as regular windows [![Contributor Preferences](https://img.shields.io/badge/Contributor_Preferences-✔-success)](#contributor-preferences) ![Not Reliable](https://img.shields.io/badge/Not_Reliable-β-yellow)
191193

192194
If you want Stretchly breaks to act as regular windows (have a titlebar, turn off always on top, be minimizable and focusable) set `showBreaksAsRegularWindows` to `true`.
193195

app/main.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,10 @@ function startMicrobreak () {
619619
microbreakWinLocal.setAlwaysOnTop(!showBreaksAsRegularWindows, 'pop-up-menu')
620620
if (microbreakWinLocal) {
621621
microbreakWinLocal.on('close', (e) => {
622-
if (!appIsQuitting && !microbreakWinLocal.fullScreen) {
623-
e.preventDefault()
622+
if (settings.get('showBreaksAsRegularWindows')) {
623+
if (!appIsQuitting && !microbreakWinLocal.fullScreen) {
624+
e.preventDefault()
625+
}
624626
}
625627
})
626628
microbreakWinLocal.on('closed', () => {
@@ -752,8 +754,10 @@ function startBreak () {
752754
breakWinLocal.setAlwaysOnTop(!showBreaksAsRegularWindows, 'pop-up-menu')
753755
if (breakWinLocal) {
754756
breakWinLocal.on('close', (e) => {
755-
if (!appIsQuitting && !breakWinLocal.fullScreen) {
756-
e.preventDefault()
757+
if (settings.get('showBreaksAsRegularWindows')) {
758+
if (!appIsQuitting && !breakWinLocal.fullScreen) {
759+
e.preventDefault()
760+
}
757761
}
758762
})
759763
breakWinLocal.on('closed', () => {

0 commit comments

Comments
 (0)