Take raw pointer and not wxSharedPtr<> in SetData()
Using shared pointer seems to be ill-advised here, the stream shouldn't be shared as it's going to be used by wxWebRequest itself and can't be used by the application code in parallel, so the ownership transfer semantics is more appropriate. We could take a wxScopedPtr<> instead, but wx API takes ownership of raw pointers everywhere else, so do it here too. Incidentally fix a bug with calling IsOk() on a possibly null pointer.
This commit is contained in:
parent
63f1260739
commit
989cafe535
5 changed files with 38 additions and 16 deletions
|
|
@ -178,10 +178,10 @@ TEST_CASE_METHOD(RequestFixture, "WebRequest", "[net][webrequest]")
|
|||
SECTION("PUT file data")
|
||||
{
|
||||
Create("/put");
|
||||
wxSharedPtr<wxInputStream> is(new wxFileInputStream("horse.png"));
|
||||
wxScopedPtr<wxInputStream> is(new wxFileInputStream("horse.png"));
|
||||
REQUIRE( is->IsOk() );
|
||||
|
||||
request.SetData(is, "image/png");
|
||||
request.SetData(is.release(), "image/png");
|
||||
request.SetMethod("PUT");
|
||||
Run();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue