fix deadlock after "cut to note", closes #1030

This commit is contained in:
zadam
2020-05-19 22:58:08 +02:00
parent fa5d982a55
commit 58f4f5d1e6
7 changed files with 61 additions and 54 deletions

View File

@@ -229,7 +229,7 @@ subscribeToMessages(message => {
async function processSyncRows(syncRows) {
const missingNoteIds = [];
for (const {id, entityName, entity} of syncRows) {
for (const {entityName, entity} of syncRows) {
if (entityName === 'branches' && !(entity.parentNoteId in treeCache.notes)) {
missingNoteIds.push(entity.parentNoteId);
}

View File

@@ -9,9 +9,11 @@ class ZoomService extends Component {
constructor() {
super();
options.initializedPromise.then(() => {
this.setZoomFactor(options.getFloat('zoomFactor'));
});
if (utils.isElectron()) {
options.initializedPromise.then(() => {
this.setZoomFactor(options.getFloat('zoomFactor'));
});
}
}
setZoomFactor(zoomFactor) {

View File

@@ -82,6 +82,10 @@ export default class Component {
let release;
try {
if (this.mutex.isLocked()) {
console.debug("Mutex locked for", this.constructor.name);
}
release = await this.mutex.acquire();
await fun.call(this, data);
@@ -93,4 +97,4 @@ export default class Component {
}
}
}
}
}

View File

@@ -308,9 +308,10 @@ export default class NoteDetailWidget extends TabAwareWidget {
return;
}
await noteCreateService.createNote(note.noteId, {
// without await as this otherwise causes deadlock through component mutex
noteCreateService.createNote(note.noteId, {
isProtected: note.isProtected,
saveSelection: true
});
}
}
}