GNOME Bugzilla – Bug 316120
[PATCH-UPDATED]Exception Thrown during index of .ppt's
Last modified: 2005-10-28 19:33:12 UTC
Distribution/Version: Debian Unstable When beagle attempted to index the attached file, the following exception was thrown, this is from the CVS build of both Beagel and gsf-sharp at Monday the 12th of Sept DEBUG: -file:///home/kevin/Documents/APES/Miller 0534-37697-5_Ch01a.ppt DEBUG: +file:///home/kevin/Documents/APES/Miller 0534-37697-5_Ch01a.ppt ERROR: Exception occurred duing DoPullProperties. ERROR: System.NullReferenceException: Object reference not set to an instance of an object in <0x00000> <unknown method> in (wrapper managed-to-native) GLib.Value:g_value_get_string (GLib.Value&) in <0x0000e> GLib.Value:op_Explicit (Value val) in <0x00163> Beagle.Filters.FilterPPT:ExtractMetaData (Gsf.Input sumStream, Gsf.Input docSumStream) in <0x0011f> Beagle.Filters.FilterPPT:DoPullProperties ()
Created attachment 52142 [details] Attachment mentioned in inital report
Ok, my investigations have showed that this is a bug in the mono-marshaller that tries to marshall GValue to be a managed-type. When I use IntPtrs in gsf-sharp in place of (G)Values, it works perfectly fine. So, I would suggest filing this in mono (or are there any bug already open in mono/glib-sharp?)
Varadhan: Can you file the bug against gtk#? You are probably more qualified to follow up with the mono developers than the reporter.
Joe: Sure, Will do that. Also, attaching the work-around for the PPT bug. (for the time being, people can use it for their PPT indexing). There are two patches, one for gsf-sharp and the other for beagle.
Created attachment 52474 [details] [review] Patch to be applied against gsf-sharp
Created attachment 52475 [details] [review] Patch to be applied againt beagle-HEAD
Created attachment 52476 [details] [review] Patch to be applied againt beagle-HEAD
*** Bug 316616 has been marked as a duplicate of this bug. ***
+ if (prop != null) { + val = prop.Val; + str = prop.ValAsString (val); + } I don't understand why val is necessary. It seems overly verbose. It should either be a static method on DocProp, ie: str = DocProp.ValAsString (prop.Val); or an instance method on DocProp: str = prop.ValAsString (); That'll make the code much easier to read.
Ah!! I think you are right. str = prop.ValAsString() should be fine. However, it requires a fix in gsf-sharp. Also, are we going to use IntPtr or GValue, in gsf-sharp?
Created attachment 53995 [details] [review] Changes required in FilterPPT.cs Use this patch along with the next one (gsf-sharp). Both the patches are required to fix this bug.
Created attachment 53996 [details] [review] This fixes the bug in gsf-sharp and the one in b.x.c - 76185 This patch is required along with the previous one. This patch applies against the current SVN Head of gsf-sharp. Joe: I think it would be better to bump the version of gsf-sharp, to avoid FilterPPT getting crashed for the next beagle release.
Did you test the setting codepath? This was the code: +void +gsf_doc_prop_glue_set_val (GsfDocProp const* prop, GValue *value) +{ + GValue* prop_val; + GType type; + + if (prop == NULL) + return; + + if (value == NULL || !G_IS_VALUE (value)) + return; + + g_value_init (prop_val, G_VALUE_TYPE (value)); + g_value_copy (value, prop_val); + + gsf_doc_prop_set_val (prop, prop_val); +} This accesses uninitialized memory, because prop_val points to a random memory address. I changed this to do the GValue stuff on the stack instead. This was visible in the warning: gsf-doc-prop-glue.c:63: warning: 'prop_val' is used uninitialized in this function I've fixed this (and the other warnings) up and committed.
This is all checked in now.