Re: [OpenBabel-Devel] Segfault in OBForceField::MakeNewInstance()

2011-10-14 Thread My Th
Pk, 2011-10-14 00:04 +0300, My Th rakstīja: C , 2011-10-13 23:13 +0300, My Th rakstīja: C , 2011-10-13 13:53 -0400, David Lonie rakstīja: There does seem to be a new problem that took its place. In the attached script, I've added line 36, which will print the name of the forcefield

Re: [OpenBabel-Devel] Segfault in OBForceField::MakeNewInstance()

2011-10-14 Thread David Lonie
On Fri, Oct 14, 2011 at 12:04 PM, My Th rei4...@gmail.com wrote: Here is a patch for plugin constructors. It is a bit big because I decompacted the macros to make them readable, but there is really only one change - an if statement which checks if the ID is already in the Map() and only if not

Re: [OpenBabel-Devel] Segfault in OBForceField::MakeNewInstance()

2011-10-14 Thread Chris Morley
On 13/10/2011 22:04, My Th wrote: C , 2011-10-13 23:13 +0300, My Th rakstīja: C , 2011-10-13 13:53 -0400, David Lonie rakstīja: As I understand, plugins do not keep track of their instances. So when you create new one with MakeNewInstance() the reference to old one is lost (Doesn't it lead

Re: [OpenBabel-Devel] Segfault in OBForceField::MakeNewInstance()

2011-10-14 Thread My Th
Pk, 2011-10-14 20:45 +0100, Chris Morley rakstīja: On 13/10/2011 22:04, My Th wrote: Other solution would be to change the constructor so that pointers in plugin map are not overwritten if the instance with the same ID already exists. First task would be to solve the issue with

Re: [OpenBabel-Devel] Segfault in OBForceField::MakeNewInstance()

2011-10-13 Thread David Lonie
On Wed, Oct 12, 2011 at 6:39 PM, My Th rei4...@gmail.com wrote: T , 2011-10-12 17:17 -0400, David Lonie rakstīja: On Wed, Oct 12, 2011 at 4:53 PM, My Th rei4...@gmail.com wrote: The reason it breaks on making second instance is that you invalidate plugin map pointers by deleting the

Re: [OpenBabel-Devel] Segfault in OBForceField::MakeNewInstance()

2011-10-13 Thread My Th
C , 2011-10-13 23:13 +0300, My Th rakstīja: C , 2011-10-13 13:53 -0400, David Lonie rakstīja: There does seem to be a new problem that took its place. In the attached script, I've added line 36, which will print the name of the forcefield that was found. When I run the test script now, I

[OpenBabel-Devel] Segfault in OBForceField::MakeNewInstance()

2011-10-12 Thread David Lonie
Hi list, I've written a routine that makes a copy of the UFF forcefield with MakeNewInstance() and caches it in a member variable of the my class. The function's definition is: bool MyClass::setupForcefield() { QMutexLocker locker (this-m_ffMutex); // already setup! if (m_ff !=

Re: [OpenBabel-Devel] Segfault in OBForceField::MakeNewInstance()

2011-10-12 Thread David Lonie
On Wed, Oct 12, 2011 at 3:25 PM, David Lonie lonieda...@gmail.com wrote: Hi list, I've written a routine that makes a copy of the UFF forcefield with MakeNewInstance() and caches it in a member variable of the my class. snip This works perfectly the first time it is used -- the forcefield is

Re: [OpenBabel-Devel] Segfault in OBForceField::MakeNewInstance()

2011-10-12 Thread My Th
T , 2011-10-12 15:42 -0400, David Lonie rakstīja: On Wed, Oct 12, 2011 at 3:25 PM, David Lonie lonieda...@gmail.com wrote: Hi list, I've written a routine that makes a copy of the UFF forcefield with MakeNewInstance() and caches it in a member variable of the my class. snip This works

Re: [OpenBabel-Devel] Segfault in OBForceField::MakeNewInstance()

2011-10-12 Thread David Lonie
On Wed, Oct 12, 2011 at 4:53 PM, My Th rei4...@gmail.com wrote: T , 2011-10-12 15:42 -0400, David Lonie rakstīja: On Wed, Oct 12, 2011 at 3:25 PM, David Lonie lonieda...@gmail.com wrote: Hi list, I've written a routine that makes a copy of the UFF forcefield with MakeNewInstance() and

Re: [OpenBabel-Devel] Segfault in OBForceField::MakeNewInstance()

2011-10-12 Thread My Th
T , 2011-10-12 17:17 -0400, David Lonie rakstīja: On Wed, Oct 12, 2011 at 4:53 PM, My Th rei4...@gmail.com wrote: The reason it breaks on making second instance is that you invalidate plugin map pointers by deleting the instance. Those pointers are set by the constructor to point to the