generated UNO code for service constructors
Noel Grandin
noel at peralex.com
Thu Feb 14 05:54:33 PST 2013
Hi
I just ran into a weird bug where I could see that the service was being
correctly instantiated, but then as a traced it back up the call tree,
the reference was suddenly empty!
(https://bugs.freedesktop.org/show_bug.cgi?id=60804)
That was because of the generated UNO code for the service constructor
in FilePicker.hpp:
(note that I've simplified it a little)
static Reference< XFilePicker3 > createDefault(Reference<
XComponentContext > const & the_context) {
assert(the_context.is());
Reference< XFilePicker3 > the_instance;
try {
the_instance = Reference< XFilePicker3 >(
the_context->getServiceManager()->createInstanceWithArgumentsAndContext(
"com.sun.star.ui.dialogs.FilePicker" ,
Sequence<Any>(),
the_context),
UNO_QUERY);
} catch (RuntimeException &) {
throw;
} catch (Exception & the_exception) {
throw DeploymentException( "component context fails to supply
service FilePicker of type XFilePicker3: "
+ the_exception.Message, the_context);
}
if (!the_instance.is()) {
throw DeploymentException( "component context fails to supply
service FilePicker of type XFilePicker3" ), the_context);
}
return the_instance;
}
Perhaps we should be making it use the constructor form Reference<X>(..,
UNO_QUERY_THROW) ?
Or perhaps we can change the error message in the last block to:
throw DeploymentException( "component context supplied a service
FilePicker, but the service does not implement interface XFilePicker3"
), the_context);
Which would be less confusing to my rather tired brain.
Thanks, Noel Grandin
Disclaimer: http://www.peralex.com/disclaimer.html
More information about the LibreOffice
mailing list