Skip to content

Commit

Permalink
Merge pull request rmagick-temp#117 from u338steven/patch-11
Browse files Browse the repository at this point in the history
Fixed: crash trying to 'test_write' on Windows (Image3.rb, ImageList2.rb)
  • Loading branch information
ioquatix committed Aug 30, 2014
2 parents ce1ae00 + 54efe84 commit dcf3cae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ext/RMagick/rmilist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,12 @@ ImageList_write(VALUE self, VALUE file)

// Ensure file is open - raise error if not
GetOpenFile(file, fptr);
#if defined(_WIN32)
add_format_prefix(info, fptr->pathv);
SetImageInfoFile(info, NULL);
#else
SetImageInfoFile(info, GetReadFile(fptr));
#endif
}
else
{
Expand Down
6 changes: 6 additions & 0 deletions ext/RMagick/rmimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -14733,8 +14733,14 @@ Image_write(VALUE self, VALUE file)
// Ensure file is open - raise error if not
GetOpenFile(file, fptr);
rb_io_check_writable(fptr);
#if defined(_WIN32)
add_format_prefix(info, fptr->pathv);
strcpy(image->filename, info->filename);
SetImageInfoFile(info, NULL);
#else
SetImageInfoFile(info, GetWriteFile(fptr));
memset(image->filename, 0, sizeof(image->filename));
#endif
}
else
{
Expand Down

0 comments on commit dcf3cae

Please sign in to comment.