bugGNU Octave - Bugs: bug #53411, variable editor: segfault when...

 
 

bug #53411: variable editor: segfault when opening a variable twice

Submitter:  Mike Miller <mtmiller>
Submitted:  Wed 21 Mar 2018 11:16:38 PM UTC
   
 
Category:  GUI Severity:  5 - Blocker
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 22 Mar 2018 08:37:36 PM UTC, comment #10: 

Pushed the patch on the stable branch, closing as fixed, thanks for the quick resolution

https://hg.savannah.gnu.org/hgweb/octave/rev/241b80a7d8c7

Mike Miller <mtmiller>
Group Member
Thu 22 Mar 2018 08:10:20 PM UTC, comment #9: 

OK, focus behavior isn't important to this crash.

Maybe we should open a separate report for focus behavior.  I know user's will complain about it.  It is kind of confusing and conflates with other bugs when trying to debug.

Dan Sebald <sebald>
Thu 22 Mar 2018 08:01:39 PM UTC, comment #8: 

This patch fixes the crash for me, shall I push on stable?

I'm not following all the talk about focus here, is the patch in file #43622 complete to close this bug report?

Mike Miller <mtmiller>
Group Member
Thu 22 Mar 2018 07:35:28 PM UTC, comment #7: 

The focus can be adjusted.  However, there are some ongoing changes to octave_dock_widget which is broader in nature that would be good to have in place before tweaking focus behavior within the subwindow (involves proxies and such):

https://savannah.gnu.org/bugs/index.php?53276
https://savannah.gnu.org/bugs/index.php?53410

I'd say apply the blocker patch and then leave this one open.

Sans the changeset posted at th following report:

https://savannah.gnu.org/bugs/index.php?53410

notice that the Variable Editor title bar highlight doesn't seem to agree exactly with the rest of the octave_dock_widget objects.  Currently the Variable Editor window is NoFocus.  It would be nice if the title bar could indicate "active" (i.e., highlighted) whenever something within that window is active/in-focus.  (I'd prefer a slightly different highlighting scheme too, e.g., not selected be a transparent titlebar rather than some other color.)  It's just that I think of all the octave_dock_widget panels as one group, and then the items within that object are another group, etc.

Dan Sebald <sebald>
Thu 22 Mar 2018 07:18:17 PM UTC, comment #6: 

Also confirmed on Windows.

Philip Nienhuis <philipnienhuis>
Group Member
Thu 22 Mar 2018 07:00:13 PM UTC, comment #5: 

Yes, I'll review and test this patch on stable today.

Mike Miller <mtmiller>
Group Member
Thu 22 Mar 2018 06:53:08 PM UTC, comment #4: 

@Mike: Since you found this, do you want to review?  It is certainly a blocker for the 4.4.0 release and I've changed the Severity to make it so.  Dan's patch works for me.

Regarding the focus.  I do see using Alt+Tab that the VE window has the focus after invoking "openvar x".  However, it is the entire window, rather than the sub-window which contains the variable in question, which has the focus.  Wouldn't it be better to move the focus to the widget that actually has the variable in question?  Sample code


x = 1
openvar x
y = magic (3)
openvar y


I would expect that the array y is selected and that numbers I type would go directly into row1, column1.

Rik <rik5>
Group administrator
Thu 22 Mar 2018 02:55:19 AM UTC, comment #3: 

The attached patch fixes the crash.  I also added a few lines that will raise the variable table to the front of the desktop.  However, that doesn't apply to the Variable Editor window when it is in a QTabView.  (I would think it should do that.)

What are your thoughts on the fact Variable Editor window does appear to come to the front when the VE when it is tabbed.  Probably isn't difficult to do, but would require some thought.

(file #43622)

Dan Sebald <sebald>
Thu 22 Mar 2018 12:02:27 AM UTC, comment #2: 

Debian unstable, Gnome 3.26, Qt 5.9.

Mike Miller <mtmiller>
Group Member
Wed 21 Mar 2018 11:59:03 PM UTC, comment #1: 

Confirmed... at least on KDE/Plasma Qt 4.4.8.  (This didn't happen on Mint Cinnamon at the time I programmed it.)  What are you testing on?

The crash appears to be the last non-comment line before the "Already Open 2" statement below that I put in place for debugging (after which I added the "return" to see what FOCUS WIDGET is):


    QDockWidget *existing_qdw = m_main->findChild<QDockWidget *> (name);
    if (existing_qdw != NULL)
      {
        // Already open.

std::cerr << "Already Open 1\n";
std::cerr << "FOCUS WIDGET: " << m_main->focusWidget ();
return;
        // Put current focused variable out of focus
        QFocusEvent event (QEvent::FocusOut, Qt::OtherFocusReason);
        QApplication::sendEvent (m_main->focusWidget (), &event);

std::cerr << "Already Open 2\n";
return;
        // Put existing variable in focus and raise
        event = QFocusEvent (QEvent::FocusIn, Qt::OtherFocusReason);
        QApplication::sendEvent (existing_qdw, &event);
s


The focus widget is


>> x = eye(5);
>> openvar x
>> openvar x
>> Already Open 1
FOCUS WIDGET: 0
>>


On the system I programmed initially, I'm sure I had a fairly advanced version of Qt 5.  Either on that system the indicated focus widget is not 0 (why it's zero on KDE Qt 4.4.8 I'm not sure, as the Command Window is in focus), or Qt recognizes the widget is 0 and doesn't try sending an event to it.

In any case, this needs a sanity check on the m_main->focusWidget().  There are a few other similar issues we're trying to iron out for the GUI.  I'll address this one after those few.  Shouldn't take too long.

Dan Sebald <sebald>
Wed 21 Mar 2018 11:16:38 PM UTC, original submission:  

Octave crashes with a segmentation fault when trying to open the same variable more than once in the variable editor.

Reproducible test case:


>> x = 1
>> openvar x
>> openvar x


Double clicking on the variable in the workspace panel leads to the same outcome.

Mike Miller <mtmiller>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by sebald (Posted a comment)
  • -email is unavailable- added by mtmiller (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-22 mtmiller StatusPatch Reviewed Fixed
        Open/ClosedOpen Closed
    2018-03-22 mtmiller StatusPatch Submitted Patch Reviewed
    2018-03-22 philipnienhuis Operating SystemGNU/Linux Microsoft Windows
    2018-03-22 mtmiller StatusConfirmed Patch Submitted
    2018-03-22 rik5 Severity4 - Important 5 - Blocker
    2018-03-22 sebald Attached File- Added octave-ve_already_open_focus_check-djs2018mar21.patch, #43622
    2018-03-22 mtmiller StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code