bugfixes
This commit is contained in:
@@ -78,9 +78,12 @@ export default class WindowContainer {
|
|||||||
|
|
||||||
removeWindow(win_id: number): void {
|
removeWindow(win_id: number): void {
|
||||||
if (this._tiledWindowLookup.has(win_id)) {
|
if (this._tiledWindowLookup.has(win_id)) {
|
||||||
|
// Get index before deleting from lookup to avoid race condition
|
||||||
|
const index = this._getIndexOfWindow(win_id);
|
||||||
this._tiledWindowLookup.delete(win_id);
|
this._tiledWindowLookup.delete(win_id);
|
||||||
const index = this._getIndexOfWindow(win_id)
|
if (index !== -1) {
|
||||||
this._tiledItems.splice(index, 1);
|
this._tiledItems.splice(index, 1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (const item of this._tiledItems) {
|
for (const item of this._tiledItems) {
|
||||||
if (item instanceof WindowContainer) {
|
if (item instanceof WindowContainer) {
|
||||||
|
|||||||
@@ -164,10 +164,13 @@ export default class WindowManager implements IWindowManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeAllWindows(): void {
|
removeAllWindows(): void {
|
||||||
|
// Disconnect signals from minimized windows before clearing
|
||||||
|
this.disconnectMinimizedSignals();
|
||||||
|
this._minimizedItems.clear();
|
||||||
|
|
||||||
this._monitors.forEach((monitor: Monitor) => {
|
this._monitors.forEach((monitor: Monitor) => {
|
||||||
monitor.removeAllWindows();
|
monitor.removeAllWindows();
|
||||||
})
|
})
|
||||||
this._minimizedItems.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -253,7 +256,7 @@ export default class WindowManager implements IWindowManager {
|
|||||||
let wrapped = this._getAndRemoveWrappedWindow(window);
|
let wrapped = this._getAndRemoveWrappedWindow(window);
|
||||||
if (wrapped === undefined) {
|
if (wrapped === undefined) {
|
||||||
Logger.error("WINDOW NOT DEFINED")
|
Logger.error("WINDOW NOT DEFINED")
|
||||||
wrapped = new WindowWrapper(window, this.handleWindowMinimized);
|
wrapped = new WindowWrapper(window, (winWrap) => this.handleWindowMinimized(winWrap));
|
||||||
wrapped.connectWindowSignals(this);
|
wrapped.connectWindowSignals(this);
|
||||||
}
|
}
|
||||||
let new_mon = this._monitors.get(monitorId);
|
let new_mon = this._monitors.get(monitorId);
|
||||||
@@ -354,7 +357,7 @@ export default class WindowManager implements IWindowManager {
|
|||||||
public addWindowToMonitor(window: Meta.Window) {
|
public addWindowToMonitor(window: Meta.Window) {
|
||||||
|
|
||||||
Logger.log("ADDING WINDOW TO MONITOR", window, window);
|
Logger.log("ADDING WINDOW TO MONITOR", window, window);
|
||||||
var wrapper = new WindowWrapper(window, this.handleWindowMinimized)
|
var wrapper = new WindowWrapper(window, (winWrap) => this.handleWindowMinimized(winWrap))
|
||||||
wrapper.connectWindowSignals(this);
|
wrapper.connectWindowSignals(this);
|
||||||
this._addWindowWrapperToMonitor(wrapper);
|
this._addWindowWrapperToMonitor(wrapper);
|
||||||
|
|
||||||
@@ -463,6 +466,13 @@ export default class WindowManager implements IWindowManager {
|
|||||||
|
|
||||||
for (const monitor of this._monitors.values()) {
|
for (const monitor of this._monitors.values()) {
|
||||||
const activeWorkspaceIndex = global.workspace_manager.get_active_workspace().index();
|
const activeWorkspaceIndex = global.workspace_manager.get_active_workspace().index();
|
||||||
|
|
||||||
|
// Bounds check to prevent accessing invalid workspace
|
||||||
|
if (activeWorkspaceIndex >= monitor._workspaces.length || activeWorkspaceIndex < 0) {
|
||||||
|
Logger.warn(`Active workspace index ${activeWorkspaceIndex} out of bounds for monitor with ${monitor._workspaces.length} workspaces`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const workspace = monitor._workspaces[activeWorkspaceIndex];
|
const workspace = monitor._workspaces[activeWorkspaceIndex];
|
||||||
|
|
||||||
// Check if the window is directly in the workspace container
|
// Check if the window is directly in the workspace container
|
||||||
|
|||||||
Reference in New Issue
Block a user