[MutterWindow] Fixed potential NULL dereference
Avoid dereferencing NULL when the window is not yet placed on a workspace. Added doc comment, noting this function is deprecated. https://bugzilla.gnome.org/show_bug.cgi?id=592567
This commit is contained in:
parent
200cd629df
commit
e811109566
@ -722,6 +722,18 @@ const char *mutter_window_get_description (MutterWindow *self)
|
|||||||
return self->priv->desc;
|
return self->priv->desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mutter_window_get_workspace:
|
||||||
|
* @self: #MutterWindow
|
||||||
|
*
|
||||||
|
* Returns the index of workspace on which this window is located; if the
|
||||||
|
* window is sticky, or is not currently located on any workspace, returns -1.
|
||||||
|
* This function is deprecated and should not be used in newly written code;
|
||||||
|
* meta_window_get_workspace() instead.
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): index of workspace on which this window is
|
||||||
|
* located.
|
||||||
|
*/
|
||||||
gint
|
gint
|
||||||
mutter_window_get_workspace (MutterWindow *self)
|
mutter_window_get_workspace (MutterWindow *self)
|
||||||
{
|
{
|
||||||
@ -738,6 +750,9 @@ mutter_window_get_workspace (MutterWindow *self)
|
|||||||
|
|
||||||
workspace = meta_window_get_workspace (priv->window);
|
workspace = meta_window_get_workspace (priv->window);
|
||||||
|
|
||||||
|
if (!workspace)
|
||||||
|
return -1;
|
||||||
|
|
||||||
return meta_workspace_index (workspace);
|
return meta_workspace_index (workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user