Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1526 break observer with relationship #1528

Closed
codehz opened this issue Jan 22, 2025 · 1 comment
Closed

#1526 break observer with relationship #1528

codehz opened this issue Jan 22, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@codehz
Copy link

codehz commented Jan 22, 2025

Describe the bug
When updated to latest snapshot version, I found my program is broken, I'm not sure if this is a correct usage, but it worked in previous versions

To Reproduce
mininal repo:

#include "flecs.h"

static void TestObserver(ecs_iter_t *it) {}

int main() {
  ecs_world_t *ecs = ecs_init();

  ECS_TAG(ecs, Tag);
  ECS_TAG(ecs, Rel);

  ECS_OBSERVER(ecs, TestObserver, EcsMonitor, Tag, Tag($o), (Rel, $o));

  ecs_entity_t a = ecs_new(ecs);
  ecs_entity_t b = ecs_new(ecs);
  ecs_defer_begin(ecs);
  ecs_add(ecs, a, Tag);
  ecs_add(ecs, b, Tag);
  ecs_add_pair(ecs, a, Rel, b);
  ecs_defer_end(ecs);

  ecs_fini(ecs);
}

result:

fatal: flecs.c: 15175: assert: observer_src != 0 INTERNAL_ERROR
1   test                                0x0000000102631238 flecs_log_msg + 1676
2   test                                0x0000000102656dd8 ecs_printv_ + 212
3   test                                0x000000010260a68c ecs_log_ + 100
4   test                                0x00000001025ff848 ecs_assert_log_ + 264
5   test                                0x000000010262cb7c flecs_uni_observer_invoke + 928
6   test                                0x000000010262bd18 flecs_observers_invoke + 328
7   test                                0x0000000102605018 flecs_emit + 6940
8   test                                0x00000001026e67c4 flecs_notify_on_add + 532
9   test                                0x000000010261c698 flecs_cmd_batch_for_entity + 2820
10  test                                0x0000000102609858 flecs_defer_end + 1724
11  test                                0x000000010260738c ecs_defer_end + 180
12  test                                0x00000001025f6e68 main + 932
13  dyld                                0x0000000190050274 start + 2840
fish: Job 1, './test' terminated by signal SIGABRT (Abort)

Expected behavior
not crash

Additional context
reference: #1526

@codehz codehz added the bug Something isn't working label Jan 22, 2025
@codehz codehz changed the title https://github.com/SanderMertens/flecs/commit/848c028f6b0069057317113e9835a507290086f4 break observer with relationship 848c02 break observer with relationship Jan 22, 2025
@codehz codehz changed the title 848c02 break observer with relationship 848c028 break observer with relationship Jan 22, 2025
@codehz codehz changed the title 848c028 break observer with relationship #1526 break observer with relationship Jan 22, 2025
@SanderMertens
Copy link
Owner

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants