Hi,

I have an issue with the cartridge - mol_to_svg() changes the input molecule so I want to make MolGetSVG() to work on a copy of the input molecule instead.

In Code/PgSQL/rdkit/adapter.cpp:

   extern "C" char *MolGetSVG(CROMol i, unsigned int w, unsigned int h,
                               const char *legend, const char *params) {
      // This is the original code that makes a read-write
      // "im" that is passed to the drawing routines where
      // it gets changed.
      RWMol *im = (RWMol *)i;

      // SVG routines need an RWMol since they change the
      // molecule as they prepare it for drawing. We don't
      // want a plain SQL function (mol_to_svg) to have
      // unexpected side effects, so take a copy and render
      // (and change) that instead.
      RWMol *input_mol = (RWMol *)i;
      RWMol input_copy = *input_mol;
      RWMol *im = &input_copy;

      ...

My construction of the "input_copy" object is obviously wrong, 'cause the database crashes. What is the correct way of copying an RWMol object ?

Cheers
-- Jan

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to