Compare commits

...

5 Commits

Author SHA1 Message Date
timd 0dedbe5fdc
Merge 846fcd3683 into 9c5dd59d4b 2024-06-28 18:26:14 -04:00
Vaxry 9c5dd59d4b input: fix capabilities enum types passed
hyprland down to the seat protocol impl expects IHID capabilities, not WL_ ones

ref #6702 #6196
2024-06-29 00:23:02 +02:00
Vaxry d16c6aa1db pointer-constraint: set lifetime correctly
ref #6679
2024-06-29 00:18:24 +02:00
Tom Englund ac11771348
core: fix a few ubsan issues reported at exit of hyprland (#6699)
* watchdog: dont detach and cause race condition

instead of detaching and causing a race condition on destruction where
the thread is alive and watchdog has been destroyed, check if its
joinable and join it on destruction.

causes heap use after free on exit of compositor.

* render: add checks for compositor shutting down

avoid member call on null pointer, if the g_pHyprRenderer is destroyed
we can call the member makeEGLCurrent on it, causes undefined behaviour
on destruction of the compositor/hyprrenderer.

found with ubsan.
2024-06-28 22:24:32 +02:00
Timothy DeHerrera 846fcd3683
nix: fix build by deferring submodule fetching
Currently, it isn't possible to fetch submodules on `inputs.self` of a
Nix flake. As a workaround, use `builtins.fetchGit` with `self.rev` of
the current checkout to include submodules.

This implementation defers submodule fetching to build time instead of
before the flake evaluation begins, which would be the case if it were
possible to specify submodule fetching in the `inputs` of `self` as with
other inputs. This way, when interacting with the other outputs of the
flake, the cost of fetching submodules is avoided.
2024-06-20 19:04:18 -06:00
8 changed files with 24 additions and 20 deletions

View File

@ -1,4 +1,5 @@
{
self,
lib,
stdenv,
pkg-config,
@ -68,7 +69,16 @@ assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been remov
baseName = baseNameOf (toString name);
in
! (lib.hasSuffix ".nix" baseName);
src = lib.cleanSource ../.;
src = lib.cleanSource (
if self ? rev
then builtins.fetchGit {
url = "https://github.com/hyprwm/Hyprland";
inherit (self) rev;
submodules = true;
allRefs = true;
}
else ../.
);
};
postPatch = ''

View File

@ -36,6 +36,7 @@ in {
version = "${props.version}+date=${date}_${self.shortRev or "dirty"}";
commit = self.rev or "";
inherit date;
inherit (inputs) self;
};
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
hyprland-debug = final.hyprland.override {debug = true;};

View File

@ -7,7 +7,9 @@ CWatchdog::~CWatchdog() {
m_bExitThread = true;
m_bNotified = true;
m_cvWatchdogCondition.notify_all();
m_pWatchdog.reset();
if (m_pWatchdog && m_pWatchdog->joinable())
m_pWatchdog->join();
}
CWatchdog::CWatchdog() {
@ -33,8 +35,6 @@ CWatchdog::CWatchdog() {
m_bNotified = false;
}
});
m_pWatchdog->detach();
}
void CWatchdog::startWatching() {

View File

@ -1473,14 +1473,7 @@ void CInputManager::updateCapabilities() {
if (h.expired())
continue;
auto cap = h->getCapabilities();
if (cap & HID_INPUT_CAPABILITY_KEYBOARD)
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
if (cap & HID_INPUT_CAPABILITY_POINTER)
caps |= WL_SEAT_CAPABILITY_POINTER;
if (cap & HID_INPUT_CAPABILITY_TOUCH)
caps |= WL_SEAT_CAPABILITY_TOUCH;
caps |= h->getCapabilities();
}
g_pSeatManager->updateCapabilities(caps);

View File

@ -7,8 +7,8 @@
#define LOGM PROTO::constraints->protoLog
CPointerConstraint::CPointerConstraint(SP<CZwpLockedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region_, zwpPointerConstraintsV1Lifetime lifetime) :
resourceL(resource_), locked(true) {
CPointerConstraint::CPointerConstraint(SP<CZwpLockedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region_, zwpPointerConstraintsV1Lifetime lifetime_) :
resourceL(resource_), locked(true), lifetime(lifetime_) {
if (!resource_->resource())
return;
@ -46,8 +46,8 @@ CPointerConstraint::CPointerConstraint(SP<CZwpLockedPointerV1> resource_, SP<CWL
sharedConstructions();
}
CPointerConstraint::CPointerConstraint(SP<CZwpConfinedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region_, zwpPointerConstraintsV1Lifetime lifetime) :
resourceC(resource_), locked(false) {
CPointerConstraint::CPointerConstraint(SP<CZwpConfinedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region_, zwpPointerConstraintsV1Lifetime lifetime_) :
resourceC(resource_), locked(false), lifetime(lifetime_) {
if (!resource_->resource())
return;

View File

@ -16,8 +16,8 @@ class CWLSurfaceResource;
class CPointerConstraint {
public:
CPointerConstraint(SP<CZwpLockedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region, zwpPointerConstraintsV1Lifetime lifetime);
CPointerConstraint(SP<CZwpConfinedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region, zwpPointerConstraintsV1Lifetime lifetime);
CPointerConstraint(SP<CZwpLockedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region, zwpPointerConstraintsV1Lifetime lifetime_);
CPointerConstraint(SP<CZwpConfinedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region, zwpPointerConstraintsV1Lifetime lifetime_);
~CPointerConstraint();
bool good();

View File

@ -6,7 +6,7 @@
#include <dlfcn.h>
CRenderbuffer::~CRenderbuffer() {
if (!g_pCompositor)
if (!g_pCompositor || g_pCompositor->m_bIsShuttingDown || !g_pHyprRenderer)
return;
g_pHyprRenderer->makeEGLCurrent();

View File

@ -9,7 +9,7 @@ CTexture::CTexture() {
}
CTexture::~CTexture() {
if (m_bNonOwning)
if (m_bNonOwning || !g_pCompositor || g_pCompositor->m_bIsShuttingDown || !g_pHyprRenderer)
return;
g_pHyprRenderer->makeEGLCurrent();