[CDRIVER-301] Inconvenient destruction of mongoc_gridfs_file_t Created: 19/Mar/14  Updated: 03/May/17  Resolved: 20/May/14

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Vahe Sahakyan Assignee: Christian Hergert
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The problem is that after getting stream from mongoc_gridfs_file_t, it's impossible to destroy only stream, since during stream destruction gridfs_file is also destroyed. So it's causes at least to problems.

1. In order to destroy gridfs_file you should know if stream was already opened and call mongoc_stream_destroy otherwise call mongoc_gridfs_file_destroy.
2. It's impossible to reuse gridfs_file, because it's destroyed with stream.



 Comments   
Comment by Christian Hergert [ 20/May/14 ]

I pushed a fix for this to master. Better to fix this now before we start locking down ABI.

https://github.com/mongodb/mongo-c-driver/commit/07dde6c98463923c795f98623e256bf592b470a9

Comment by Christian Hergert [ 20/May/14 ]

I actually don't like this either, it feels inconsistent with the rest of the API. I'll take a look this week.

Generated at Wed Feb 07 21:09:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.