Check the thread is ready before adding events
Prevents segmentation faults when accessing the NULL stream buffer without a clear message of what is happening.
This commit is contained in:
parent
0439399f05
commit
6bfacf0e1e
@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Calling `ovni_thread_isready()` after `ovni_thread_free()` now returns 0.
|
- Calling `ovni_thread_isready()` after `ovni_thread_free()` now returns 0.
|
||||||
|
- Emitting events in a non-ready thread now aborts the program with a
|
||||||
|
message rather than causing a segfault.
|
||||||
|
|
||||||
## [1.5.0] - 2023-12-15
|
## [1.5.0] - 2023-12-15
|
||||||
|
|
||||||
|
@ -767,6 +767,9 @@ add_flush_events(uint64_t t0, uint64_t t1)
|
|||||||
static void
|
static void
|
||||||
ovni_ev_add_jumbo(struct ovni_ev *ev, const uint8_t *buf, uint32_t bufsize)
|
ovni_ev_add_jumbo(struct ovni_ev *ev, const uint8_t *buf, uint32_t bufsize)
|
||||||
{
|
{
|
||||||
|
if (!rthread.ready)
|
||||||
|
die("thread is not initialized");
|
||||||
|
|
||||||
int flushed = 0;
|
int flushed = 0;
|
||||||
uint64_t t0, t1;
|
uint64_t t0, t1;
|
||||||
|
|
||||||
@ -808,6 +811,9 @@ ovni_ev_add_jumbo(struct ovni_ev *ev, const uint8_t *buf, uint32_t bufsize)
|
|||||||
static void
|
static void
|
||||||
ovni_ev_add(struct ovni_ev *ev)
|
ovni_ev_add(struct ovni_ev *ev)
|
||||||
{
|
{
|
||||||
|
if (!rthread.ready)
|
||||||
|
die("thread is not initialized");
|
||||||
|
|
||||||
int flushed = 0;
|
int flushed = 0;
|
||||||
uint64_t t0, t1;
|
uint64_t t0, t1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user