bad c++ (or bug 596)


Subject: bad c++ (or bug 596)
From: sam th (sam@bur-jud-118-039.rh.uchicago.edu)
Date: Wed May 10 2000 - 06:01:52 CDT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is the description of bug 596

The following causes a core dump every time:

1. Start Abiword
2. Type a few characters (say, "foo")
3. Select the text
4. Change the zoom percentage: note the selection highlight disappears
5. Re-select the text: core dump

Now, this is a serious problem. However, more revealing info is to be had
if you select some text, change the zoom, and then select different text.
you get an error saying 'pure virtual method called.' Now this is bad.
The funtion being called is cmdUnselectSelection, which is a method of the
classes FV_View and AP_View, where it is non-virtual, and it is a
pure virtual function in AV_View. So this error means that we have
committed a cardinal sin, and instantiated an abstract class.

The code making the bad call is

m_pViewSelection->cmdUnselectSelection();

And indeed, GDB tells us that m_pViewSelection is of type AV_View.

Now, m_pViewSelection is declared in ap_UnixApp.h as AV_View. And the
only place that it gets casted like a good C++ object is in
getCurrentSelection(). Needless to say, this has not been called on
m_pViewSelection.

It should also be noted that the other function that
cmdUnselectSelection() (clearSelection) exhibits the same behavior. To
test, follow steps 1-4 above, and then click on another window (causing
that AbiWord window to lose selection). Instant segfault.

More info hopefully following.

           
                                     sam th
                                     sam@uchicago.edu
                                http://sam.rh.uchicago.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE5GUGit+kM0Mq9M/wRAg4XAJ0bQlwkZVLgBKUvo6ii9P/RJhHYtgCglu6a
MFaTmeq/dtPCfkMap5j+kEQ=
=HMdX
-----END PGP SIGNATURE-----



This archive was generated by hypermail 2b25 : Wed May 10 2000 - 06:02:16 CDT