Skip to content

Commit

Permalink
Merge pull request #60 from NuiCpp/devel
Browse files Browse the repository at this point in the history
Fixed binaryen pull on Ubuntu and Scheme handler cleanup.
  • Loading branch information
5cript authored Aug 28, 2023
2 parents 606b2eb + a47180a commit 8111a21
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
11 changes: 8 additions & 3 deletions cmake/dependencies/binaryen.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
option(NUI_FETCH_BINARYEN "Fetch binaryen" ON)
set(NUI_BINARYEN_URL "https://github.com/WebAssembly/binaryen/releases/download/version_112/binaryen-version_112-x86_64-windows.tar.gz" CACHE STRING "Binaryen url")

if (WIN32)
set(NUI_BINARYEN_URL "https://github.com/WebAssembly/binaryen/releases/download/version_114/binaryen-version_114-x86_64-windows.tar.gz" CACHE STRING "Binaryen url")
elseif(UNIX)
set(NUI_BINARYEN_URL "https://github.com/WebAssembly/binaryen/releases/download/version_114/binaryen-version_114-x86_64-linux.tar.gz" CACHE STRING "Binaryen url")
endif()

if (NUI_FETCH_BINARYEN)
include(FetchContent)
FetchContent_Declare(
binaryen_release
URL ${NUI_BINARYEN_URL}
DOWNLOAD_EXTRACT_TIMESTAMP true
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
URL "${NUI_BINARYEN_URL}"
)
FetchContent_GetProperties(binaryen_release)
if (binaryen_release_POPULATED)
Expand Down
11 changes: 5 additions & 6 deletions nui/src/nui/backend/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ namespace Nui
GInputStream* stream;
SoupMessageHeaders* headers;
WebKitURISchemeResponse* response;

~SchemeContext()
{
g_object_unref(stream);
soup_message_headers_free(headers);
}
#endif
};
// #####################################################################################################################
Expand Down Expand Up @@ -187,8 +181,13 @@ extern "C" {
}

exitError.disarm();

schemeContext->stream =
g_memory_input_stream_new_from_data(fileContent.c_str(), static_cast<gssize>(fileContent.size()), nullptr);
auto deleteStream = Roar::ScopeExit{[schemeContext] {
g_object_unref(schemeContext->stream);
}};

const auto maybeMime = Roar::extensionToMime(filePath.extension().string());
schemeContext->mime = maybeMime ? *maybeMime : "application/octet-stream";

Expand Down

0 comments on commit 8111a21

Please sign in to comment.