Skip to content

Commit 8e7e8c9

Browse files
committed
Fix subscription listeners key
_listeners used a string_view as key, it would point to the first registration->field value, but once that value is gone, the reference will point to garbage and the process will crash. Change it to a string, the copy is harmless given the other costs of subscription. Closes: #162
1 parent 17b8df6 commit 8e7e8c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/graphqlservice/GraphQLService.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ class Request : public std::enable_shared_from_this<Request>
10021002
const TypeMap _operations;
10031003
std::unique_ptr<ValidateExecutableVisitor> _validation;
10041004
internal::sorted_map<SubscriptionKey, std::shared_ptr<SubscriptionData>> _subscriptions;
1005-
internal::string_view_map<internal::sorted_set<SubscriptionKey>> _listeners;
1005+
internal::sorted_map<SubscriptionName, internal::sorted_set<SubscriptionKey>> _listeners;
10061006
SubscriptionKey _nextKey = 0;
10071007
};
10081008

0 commit comments

Comments
 (0)