After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 324340 - crash on cutting element
crash on cutting element
Status: RESOLVED FIXED
Product: conglomerate
Classification: Other
Component: Code - Editor Widget
0.9.0
Other Linux
: Normal critical
: ---
Assigned To: conglomerate list
conglomerate list
Depends on:
Blocks:
 
 
Reported: 2005-12-17 17:46 UTC by Joachim Noreiko
Modified: 2010-01-04 07:39 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
backtrace for the crash, copied from BugBuddy (13.52 KB, text/plain)
2005-12-21 23:00 UTC, Joachim Noreiko
  Details
More detailed backtrace from head revision in git (5.83 KB, text/plain)
2009-12-16 15:06 UTC, Simon South
  Details
Don't replace the line manager of span elements that already have one (1.20 KB, patch)
2009-12-17 00:29 UTC, Simon South
none Details | Review

Description Joachim Noreiko 2005-12-17 17:46:42 UTC
Version details: 0.9.0debian3ubuntu1
Distribution/Version: Ubuntu 5.10

Description of the crash: I opened a DocBook document, and selected a Defined
Terms box. In the right hand pane, I did Context menu -> Cut.
The application crashed.

How often does this happen?
Every time.
Comment 1 Nickolay V. Shmyrev 2005-12-21 22:49:23 UTC
Joachim, can you attach backtrace please? I know this bug is easily reproducable, but with backtrace it will be much easier to manage this bug.
Comment 2 Joachim Noreiko 2005-12-21 23:00:28 UTC
Created attachment 56275 [details]
backtrace for the crash, copied from BugBuddy
Comment 3 Nickolay V. Shmyrev 2005-12-22 07:03:10 UTC
Seems unique
Comment 4 Nickolay V. Shmyrev 2005-12-22 07:03:46 UTC
Confirming
Comment 5 Simon South 2009-12-16 15:06:40 UTC
Created attachment 149837 [details]
More detailed backtrace from head revision in git

I get the same crash in the current version (from git) when trying to cut a ulink element from the raw-XML view of a DocBook article.  Oddly, I can cut other portions of the document just fine, but trying to cut this element or any of its parents makes Conglomerate crash.

What's happening is the line manager for this element is trying to look up the per-node data associated with it, but there is no entry for the element in the hash table it maintains for this purpose (hash_of_editor_node_to_data).  This causes an assertion failure, which leads to a crash.

I've gotten as far as determining the line manager object being asked to remove the node is _not_ the same line manager object associated with the element at the time it's created (when cong_editor_line_manager_add_node is called).  This suggests the wrong line manager is being selected at the time the element is cut (possibly by get_line_manager_for_node in cong-editor-widget3.c), or perhaps the element is reassigned to a different line manager at some point but the new line manager's hash table isn't updated to reflect this.

I'm still investigating as I have time.
Comment 6 Simon South 2009-12-16 23:08:12 UTC
The element's parent is being assigned a new line manager for its children at cong-editor-node-element-span.c:137, in cong_editor_node_element_span_create_areas.  Because the child elements aren't re-added and the hash table itself isn't carried over, the per-node data for the child elements is lost, eventually resulting in the assertion failure.
Comment 7 Simon South 2009-12-17 00:29:31 UTC
Created attachment 149889 [details] [review]
Don't replace the line manager of span elements that already have one

Here's a possible patch to fix this.  This adds an if-block that makes cong_editor_node_element_span_create_areas not replace the line manager of (parent) span elements that already have one assigned.  This means the per-node data of child elements is preserved and the assertion failure doesn't happen.

I don't know if this is what was originally intended but it seems logical and appears to solve the problem without side effects.
Comment 8 Sven Herzberg 2010-01-02 17:31:03 UTC
This patch looks good to me.

What's missing IMHO, is a simple testcase reproducing your bug scenario. Unfortunately, Conglomerate is not very well maintained. If we could have such a testcase (and we can execute the testcase against HEAD and your patched version) we could be more confident to not break any things by patching.
Comment 9 Sven Herzberg 2010-01-03 12:19:13 UTC
Why was this RESOLVED? I can't see the patch in the repository.

Can you please add links to the commits when you resolve bugs, please?