mirror of
https://github.com/elementary/gala.git
synced 2024-12-25 02:02:11 +03:00
Guard usage of actors retrieved from Meta.Compositor.get_window_actors()
Ignore an actor if is_destroyed() is true to avoid using them in an unstable state.
This commit is contained in:
parent
26b286c9cb
commit
cf82dd5ca9
@ -284,9 +284,9 @@ namespace Gala.Plugins.Notify
|
||||
|
||||
// if no default action has been set, we fallback to trying to find a window for the
|
||||
// notification's sender process
|
||||
var window = get_window ();
|
||||
unowned Meta.Window? window = get_window ();
|
||||
if (window != null) {
|
||||
var workspace = window.get_workspace ();
|
||||
unowned Meta.Workspace workspace = window.get_workspace ();
|
||||
var time = screen.get_display ().get_current_time ();
|
||||
|
||||
if (workspace != screen.get_active_workspace ())
|
||||
@ -298,13 +298,16 @@ namespace Gala.Plugins.Notify
|
||||
}
|
||||
}
|
||||
|
||||
Window? get_window ()
|
||||
unowned Meta.Window? get_window ()
|
||||
{
|
||||
if (sender_pid == 0)
|
||||
return null;
|
||||
|
||||
foreach (var actor in Compositor.get_window_actors (screen)) {
|
||||
var window = actor.get_meta_window ();
|
||||
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) {
|
||||
if (actor.is_destroyed ())
|
||||
continue;
|
||||
|
||||
unowned Meta.Window window = actor.get_meta_window ();
|
||||
|
||||
// the windows are sorted by stacking order when returned
|
||||
// from meta_get_window_actors, so we can just pick the first
|
||||
|
@ -149,8 +149,8 @@ namespace Gala
|
||||
|
||||
new_window.change_workspace_by_index (index, false);
|
||||
|
||||
foreach (var actor in actors) {
|
||||
var window = actor.get_meta_window ();
|
||||
foreach (unowned Meta.WindowActor actor in actors) {
|
||||
unowned Meta.Window window = actor.get_meta_window ();
|
||||
var window_index = window.get_workspace ().index ();
|
||||
|
||||
if (!window.on_all_workspaces
|
||||
|
@ -56,8 +56,11 @@ namespace Gala
|
||||
screen.window_entered_monitor.connect (window_entered);
|
||||
screen.window_left_monitor.connect (window_left);
|
||||
|
||||
foreach (var window_actor in Compositor.get_window_actors (screen)) {
|
||||
var window = window_actor.get_meta_window ();
|
||||
foreach (unowned Meta.WindowActor window_actor in Meta.Compositor.get_window_actors (screen)) {
|
||||
if (window_actor.is_destroyed ())
|
||||
continue;
|
||||
|
||||
unowned Meta.Window window = window_actor.get_meta_window ();
|
||||
if (window.get_monitor () == monitor) {
|
||||
window_entered (monitor, window);
|
||||
}
|
||||
|
@ -504,12 +504,13 @@ namespace Gala
|
||||
dock_clones.get_transformed_position (out clone_offset_x, out clone_offset_y);
|
||||
|
||||
if (opening) {
|
||||
unowned List<WindowActor> actors = Compositor.get_window_actors (screen);
|
||||
|
||||
foreach (var actor in actors) {
|
||||
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) {
|
||||
const int MAX_OFFSET = 100;
|
||||
|
||||
var window = actor.get_meta_window ();
|
||||
if (actor.is_destroyed ())
|
||||
continue;
|
||||
|
||||
unowned Meta.Window window = actor.get_meta_window ();
|
||||
var monitor = window.get_monitor ();
|
||||
|
||||
if (window.window_type != WindowType.DOCK)
|
||||
|
@ -430,10 +430,11 @@ namespace Gala
|
||||
window_clones.destroy_all_children ();
|
||||
|
||||
// need to go through all the windows because of hidden dialogs
|
||||
unowned List<WindowActor>? window_actors = Compositor.get_window_actors (screen);
|
||||
foreach (var actor in window_actors) {
|
||||
unowned Window window = actor.get_meta_window ();
|
||||
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) {
|
||||
if (actor.is_destroyed ())
|
||||
continue;
|
||||
|
||||
unowned Meta.Window window = actor.get_meta_window ();
|
||||
if (window.get_workspace () == workspace
|
||||
&& window.showing_on_its_workspace ())
|
||||
actor.show ();
|
||||
@ -620,8 +621,11 @@ namespace Gala
|
||||
current_window = (WindowIcon) dock.get_child_at_index (0);
|
||||
|
||||
// hide the others
|
||||
foreach (var actor in Compositor.get_window_actors (screen)) {
|
||||
var window = actor.get_meta_window ();
|
||||
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) {
|
||||
if (actor.is_destroyed ())
|
||||
continue;
|
||||
|
||||
unowned Meta.Window window = actor.get_meta_window ();
|
||||
var type = window.window_type;
|
||||
|
||||
if (type != WindowType.DOCK
|
||||
|
@ -36,9 +36,11 @@ namespace Gala
|
||||
|
||||
instance = new WindowListener ();
|
||||
|
||||
foreach (var actor in Compositor.get_window_actors (screen)) {
|
||||
var window = actor.get_meta_window ();
|
||||
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) {
|
||||
if (actor.is_destroyed ())
|
||||
continue;
|
||||
|
||||
unowned Meta.Window window = actor.get_meta_window ();
|
||||
if (window.window_type == WindowType.NORMAL)
|
||||
instance.monitor_window (window);
|
||||
}
|
||||
|
@ -1427,11 +1427,11 @@ namespace Gala
|
||||
var docks = new List<WindowActor> ();
|
||||
|
||||
// collect all windows and put them in the appropriate containers
|
||||
foreach (var actor in Compositor.get_window_actors (screen)) {
|
||||
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) {
|
||||
if (actor.is_destroyed ())
|
||||
continue;
|
||||
|
||||
var window = actor.get_meta_window ();
|
||||
unowned Meta.Window window = actor.get_meta_window ();
|
||||
|
||||
if (!window.showing_on_its_workspace () ||
|
||||
(move_primary_only && window.get_monitor () != primary) ||
|
||||
|
Loading…
Reference in New Issue
Block a user