Skip to content

Conversation

@cdown
Copy link
Owner

@cdown cdown commented May 28, 2025

When clipmenud is rapidly disabled and reenabled, stale X11 selection events queued while disabled could be processed after reenabling, causing entries we should have thrown away to be stored.

This is theoretical, there are no user reports of issues.

Fixes #217.

/**
* Get the current X server time by triggering a PropertyNotify.
*/
static Time get_current_server_time(void) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@N-R-K do you know a better way to do this? i wondered if there was some extension that can help here, but it seems not?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wondered if there was some extension that can help here, but it seems not?

@cdown Well, yes, I do happen to have a bit of esoteric knowledge in this matter. Roughly, you'd need to do the following:

  1. XSyncQueryExtension() + XSyncInitialize() at startup for initialization.
  2. Then use XSyncListSystemCounters() to get a list of available counters.
  3. Iterate over them to find "SERVERTIME".
  4. Now you should be able to use XSyncQueryCounter() to query the server time with the counter id found via step 3.

But I'm not entirely sure if this is worth the trouble. Can't client set arbitrary timestamps anyways? Though I guess from a security perspective it makes sense to completely eliminate any chances of storing a sensitive clip that should've been discarded.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I guessed you might have some knowledge here :-)

Okay, I guess we'll stick with the PropertyNotify method for now since we don't need the XSync guarantees (and it's less code).

@cdown cdown force-pushed the cdown/2025-05-29/time branch 3 times, most recently from 813ae5a to 7567846 Compare May 28, 2025 23:44
When clipmenud is rapidly disabled and reenabled, stale X11 selection
events queued while disabled could be processed after reenabling,
causing entries we should have thrown away to be stored.

This is theoretical, there are no user reports of issues.

Fixes #217.
@cdown cdown force-pushed the cdown/2025-05-29/time branch from 7567846 to 4a48733 Compare May 28, 2025 23:45
@cdown cdown merged commit ef75940 into develop May 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check serial time as part of disable rejection

3 participants