display: Fix crash from closing lid
When closing the lid on a laptop, the number of active monitors drops to zero. However, `monitor_labeler_show()` always assumes at least one monitor is active, as it unconditionally closes the `GVariantBuilder`. This causes a crash when there is no monitor added to the `GVariantBuilder`, however, as no value was added to it. Instead, only close the `GVariantBuilder` when we're actually going to use it and know a value was added. Commitca9228bb
fixed a similar crash for when there are no outputs at all. But in this case, there is still an output, it is just not active, only with the active UI number as 0. Fixes #3058 (cherry picked from commit08e32e9573
)
This commit is contained in:
parent
196ca6ce86
commit
907e5cf2c2
1 changed files with 2 additions and 2 deletions
|
@ -360,14 +360,14 @@ monitor_labeler_show (CcDisplayPanel *self)
|
|||
g_variant_new_int32 (number));
|
||||
}
|
||||
|
||||
g_variant_builder_close (&builder);
|
||||
|
||||
if (number < 2)
|
||||
{
|
||||
g_variant_builder_clear (&builder);
|
||||
return monitor_labeler_hide (self);
|
||||
}
|
||||
|
||||
g_variant_builder_close (&builder);
|
||||
|
||||
g_dbus_proxy_call (self->shell_proxy,
|
||||
"ShowMonitorLabels",
|
||||
g_variant_builder_end (&builder),
|
||||
|
|
Loading…
Add table
Reference in a new issue