First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 12567
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Dom Lachowicz <domlachowicz@gmail.com>
Hardware:
OS:
Version:
Priority:
Severity:
Target Milestone:
Reporter: Olivier Sessink <olivier@bluefish.openoffice.nl>
Add CC:
CC:
QA Contact:
URL:
Summary:
Status Whiteboard:
Keywords:

Attachment Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 12567 depends on: Show dependency tree
Show dependency graph
Bug 12567 blocks:

Additional Comments:







View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2010-01-04 07:40
The following code seems perfectly fine according to the API:

dict1 = enchant_broker_request_dict(broker, lang1);
/* use dict1 */
dict2 = enchant_broker_request_dict(broker, lang2);
/* use dict1 and dict2 */
enchant_broker_free_dict(broker, dict1);
/* use dict2 */
enchant_broker_free_dict(broker, dict2);

However, it seems that this won't work if lang1 and lang2 contain the same
language. In this case it seems that request_dict() returns the same dictionary
to dict2, and after freeing dict1 any access to dict2 segfaults. 

If this intended (I hope so) please specify this in the API.

------- Comment #1 From Olivier Sessink 2010-01-04 19:53:34 -------
as an update:

I found this on Enchant 1.3.0 32bit

I cannot reproduce this on enchant 1.5.0 64bit

could this be a fixed bug?

------- Comment #2 From Dom Lachowicz 2010-01-04 20:03:55 -------
The dictionaries are reference counted since 1.4. There should be no "double
free" error any more.

------- Comment #3 From Olivier Sessink 2010-01-04 20:39:29 -------
is there an easy way to detect the enchant version (so I can add a #ifdef in
the code to avoid the double free?)

------- Comment #4 From Dom Lachowicz 2010-01-04 20:57:40 -------
There's no way to do it from the C API, unfortunately. That's an oversight on
my part.

You can do it by calling `pkg-config --modversion enchant` or using the
equivalent autoconf PKG_CHECK_MODULES macro.

------- Comment #5 From Olivier Sessink 2010-01-05 09:58:46 -------
I'll change this to a feature request then:

- explain the refcounting in the API, so programmers can see that a language is
loaded only once if requested several times, and refcounted.

- add a function to retrieve the version number at runtime


------- Comment #6 From Dom Lachowicz 2010-01-05 13:47:10 -------
Update the summary

------- Comment #7 From Dom Lachowicz 2010-01-11 15:21:51 -------
Fixed

First Last Prev Next    No search results available      Search page      Enter new bug
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.