Bugfix: Don’t crash when changing workspace when there is more than one column
This commit is contained in:
parent
ff0e9bb954
commit
9ec6ea61de
|
@ -44,13 +44,14 @@ Workspace *workspace_get(int number) {
|
||||||
*
|
*
|
||||||
* To distinguish between the first workspace and a NULL
|
* To distinguish between the first workspace and a NULL
|
||||||
* pointer, we store <workspace number> + 1. */
|
* pointer, we store <workspace number> + 1. */
|
||||||
for (int c = 0; c < num_workspaces; c++)
|
for (int c = 0; c < num_workspaces; c++) {
|
||||||
FOR_TABLE(&(workspaces[c])) {
|
FOR_TABLE(&(workspaces[c])) {
|
||||||
Container *con = workspaces[c].table[cols][rows];
|
Container *con = workspaces[c].table[cols][rows];
|
||||||
if (con->workspace != NULL) {
|
if (con->workspace != NULL) {
|
||||||
LOG("Handling con %p with pointer %p (num %d)\n", con, con->workspace, con->workspace->num);
|
LOG("Handling con %p with pointer %p (num %d)\n", con, con->workspace, con->workspace->num);
|
||||||
con->workspace = (Workspace*)(con->workspace->num + 1);
|
con->workspace = (Workspace*)(con->workspace->num + 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Client *current;
|
Client *current;
|
||||||
SLIST_FOREACH(current, &(workspaces[c].focus_stack), focus_clients) {
|
SLIST_FOREACH(current, &(workspaces[c].focus_stack), focus_clients) {
|
||||||
if (current->workspace == NULL)
|
if (current->workspace == NULL)
|
||||||
|
@ -76,13 +77,14 @@ Workspace *workspace_get(int number) {
|
||||||
* by default, thus requiring re-rendering the layout. */
|
* by default, thus requiring re-rendering the layout. */
|
||||||
c_ws = workspace_get((int)c_ws);
|
c_ws = workspace_get((int)c_ws);
|
||||||
|
|
||||||
for (int c = 0; c < old_num_workspaces; c++)
|
for (int c = 0; c < old_num_workspaces; c++) {
|
||||||
FOR_TABLE(&(workspaces[c])) {
|
FOR_TABLE(&(workspaces[c])) {
|
||||||
Container *con = workspaces[c].table[cols][rows];
|
Container *con = workspaces[c].table[cols][rows];
|
||||||
if (con->workspace != NULL) {
|
if (con->workspace != NULL) {
|
||||||
LOG("Handling con %p with (num %d)\n", con, con->workspace);
|
LOG("Handling con %p with (num %d)\n", con, con->workspace);
|
||||||
con->workspace = workspace_get((int)con->workspace - 1);
|
con->workspace = workspace_get((int)con->workspace - 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Client *current;
|
Client *current;
|
||||||
SLIST_FOREACH(current, &(workspaces[c].focus_stack), focus_clients) {
|
SLIST_FOREACH(current, &(workspaces[c].focus_stack), focus_clients) {
|
||||||
if (current->workspace == NULL)
|
if (current->workspace == NULL)
|
||||||
|
|
Loading…
Reference in New Issue