1
0
mirror of synced 2024-12-15 01:01:15 +01:00
ImHex/lib/libimhex/include/hex
lomekragow 7fc2ff3002
fix: Event unsubscribe not working correcetly when using same key for multiple events (#1309)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->

Fixed possible bug of  `EventManager::unsubscribe`

`std::map` only allows unique key, but the same token can subscribe to
multiple events.

1a2a926b77/lib/libimhex/include/hex/api/event.hpp (L104-L107)

If the previous token has already subscribed to an event, then when
subscribing again, `getTokenStore().insert` will not do anything
(Because its type is `std::map`)


1a2a926b77/lib/libimhex/include/hex/api/event.hpp (L122-L134)

At this point in `unsubscribe`, the `iter` may not be able to find the
correct event and erase it



### Implementation description
<!-- Explain what you did to correct the problem -->

Change `tokenStore` to `std::multimap` instead of `std::map`, which
cannot unsubscribe multiple events correctly

### Screenshots
<!-- If your change is visual, take a screenshot showing it. Ideally,
make before/after sceenshots -->

### Additional things
<!-- Anything else you would like to say -->
2023-10-07 23:35:35 +02:00
..
api fix: Event unsubscribe not working correcetly when using same key for multiple events (#1309) 2023-10-07 23:35:35 +02:00
data_processor impr: Refactoring of floating point tool to decrease code complexity. (#1275) 2023-09-20 10:48:44 +02:00
helpers feat: Support for building ImHex for the web (#1328) 2023-10-04 12:00:32 +02:00
providers feat: Support for building ImHex for the web (#1328) 2023-10-04 12:00:32 +02:00
subcommands feat: Added command line interface support (#1172) 2023-07-13 14:08:23 +02:00
ui feat: Support for building ImHex for the web (#1328) 2023-10-04 12:00:32 +02:00
api_urls.hpp build: Updated libwolv 2023-04-19 21:56:34 +02:00
plugin.hpp feat: Support for building ImHex for the web (#1328) 2023-10-04 12:00:32 +02:00