Pressing almost any key twice while hovering over a bond causes a
segmentation fault because a text-editor is internally created and
discarded but not deleted. When pressing that button a second time this
will cause the program to walk down an "unexpected pathway" trying to do
something with said editor which finally creates the seg-fault.

A fix for the above exists. As I'm regularly confronted with this issue,
and I'm not expecting a new release of xdrawchem anytime soon, I would
like to see it fixed in our port.

While here take MAINTAINER.

OK?


Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/xdrawchem/Makefile,v
retrieving revision 1.28
diff -u -p -r1.28 Makefile
--- Makefile    12 Jul 2019 20:51:26 -0000      1.28
+++ Makefile    10 Aug 2019 04:22:55 -0000
@@ -4,9 +4,11 @@ COMMENT=       two-dimensional molecule drawin
 
 DISTNAME=      xdrawchem-1.10.2
 CATEGORIES=    x11 biology
-REVISION=      0
+REVISION=      1
 
 HOMEPAGE=      https://www.woodsidelabs.com/chemistry/xdrawchem.php
+
+MAINTAINER=    Bjorn Ketelaars <b...@openbsd.org>
 
 # GPLv2
 PERMIT_PACKAGE=        Yes
Index: patches/patch-xdrawchem_render2d_text_cpp
===================================================================
RCS file: patches/patch-xdrawchem_render2d_text_cpp
diff -N patches/patch-xdrawchem_render2d_text_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-xdrawchem_render2d_text_cpp   10 Aug 2019 04:22:55 -0000
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+Fix segfault when using (hot)key on bond twice in a row. Taken from
+https://github.com/bryanherger/xdrawchem/pull/12
+
+Index: xdrawchem/render2d_text.cpp
+--- xdrawchem/render2d_text.cpp.orig
++++ xdrawchem/render2d_text.cpp
+@@ -380,6 +380,9 @@ void Render2D::keyPressEvent( QKeyEvent * k )
+                 }
+ 
+                 if ( highlightobject->Type() != TYPE_TEXT ) {
++                    delete localtexteditor;
++                    localtexteditor = 0;
++
+                     hotkeymode = false;
+                     mode = hkprevmode;
+                     return;

Reply via email to