Skip to content

Commit

Permalink
Fix bugs found in testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ttalvitie committed Sep 23, 2021
1 parent 18ed00e commit 64117db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ string sanitizeUTF8String(string str) {
sanitizeUTF8StringImpl(
str,
[&](const char* bytes, size_t count) {
str.insert(str.end(), bytes, bytes + count);
ret.insert(ret.end(), bytes, bytes + count);
},
[](int) {}
);
Expand Down
12 changes: 8 additions & 4 deletions src/vice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,13 @@ void ViceContext::start(shared_ptr<ViceContextEventHandler> eventHandler) {
string reason = "Unknown reason";
uint64_t window =
self->eventHandler_->onViceContextCreateWindowRequest(reason, sanitizedURI);
if(window || msg == nullptr) {
if(window) {
REQUIRE(self->openWindows_.insert(window).second);
return window;
} else {
*msg = createMallocString(reason);
if(msg != nullptr) {
*msg = createMallocString(reason);
}
return 0;
}
});
Expand Down Expand Up @@ -470,11 +472,13 @@ void ViceContext::start(shared_ptr<ViceContextEventHandler> eventHandler) {
string reason = "Unknown reason";
uint64_t window =
self->eventHandler_->onViceContextCreateWindowRequest(reason, {});
if(window || msg == nullptr) {
if(window) {
REQUIRE(self->openWindows_.insert(window).second);
return window;
} else {
*msg = createMallocString(reason);
if(msg != nullptr) {
*msg = createMallocString(reason);
}
return 0;
}
});
Expand Down

0 comments on commit 64117db

Please sign in to comment.