Embedding kghostview in khtml

Koos Vriezen koos.vriezen at xs4all.nl
Sun May 19 15:59:06 BST 2002


Hi,

KHTML fails to create the kghostview part in this case:

  <HTML><BODY>
    <H2>application/pdf</H2>
    <EMBED src="file:/usr/share/ghostscript/6.51/examples/escher.ps"
           name="pdf" width=500 height=500 type="application/pdf">
    </EMBED></BODY></HTML>

Changing KHTMLPart::createPart in khtml_part.cpp

  const char *className = "KParts::ReadOnlyPart";
  if ( service->serviceTypes().contains( "Browser/View" ) )
    className = "Browser/View";

  if ( factory->inherits( "KParts::Factory" ) )
    res = static_cast<KParts::ReadOnlyPart *>
        (static_cast<KParts::Factory *>( factory )->createPart(...

to

  if ( factory->inherits( "KParts::Factory" ) ) {
    res = .. ->createPart( .., "Browser/View", ..);
    if (!res)
      res = .. ->createPart( .., "KParts::ReadOnlyPart", ..);
  }

as konqueror does, makes the part creation work.
However it crashes somewhere in the tokenizer. Somehow the HTML is parsed
twice.
Running this inside gdb, having a break point in KHTMLPart::slotData and
just pressing continue, the part runs fine.

It looks like some race condition. Any ideas?

Regards,

Koos Vriezen





More information about the kfm-devel mailing list