Fix crash on deconstruction
AbandonedPublic

Authored by rizzitello on May 2 2018, 10:08 PM.

Details

Summary
  • GcodeEditor + deconstructor
  • GcodeEditor, only request menu additions once
  • MainWindow, update for new GcodeEditor.
Test Plan

run atelier open a gcode, Look for added menu items... open another file... close .. oh nice no crash ...

Diff Detail

Repository
R231 Atelier
Branch
gcodeEditorFixCrash
Lint
No Linters Available
Unit
No Unit Test Coverage
rizzitello requested review of this revision.May 2 2018, 10:08 PM
rizzitello created this revision.
rizzitello edited the summary of this revision. (Show Details)May 2 2018, 10:10 PM
rizzitello edited the test plan for this revision. (Show Details)
rizzitello updated this revision to Diff 33528.May 2 2018, 10:10 PM
  • Remove empty line
src/widgets/gcodeeditorwidget.cpp
35

If it's virtual, you can only add {} in the end of the destructor declaration.

rizzitello updated this revision to Diff 33529.May 2 2018, 10:49 PM
  • update virtual
laysrodrigues requested changes to this revision.May 3 2018, 1:57 AM

  • Open two files
  • Edit the second file
  • Save the edition on second file
  • Open the second file again (You can close it or open as a third file)
  • it will give to you that warning. The file wasn't properly saved because the views are messed up.
This revision now requires changes to proceed.May 3 2018, 1:57 AM
rizzitello planned changes to this revision.May 3 2018, 11:27 AM

Planed Changed to address lays consern above.

  • GCodeEditor: Allow user to close files.
  • GCodeEditor: Prevent the user from opening the same file twice.
  • MainWindow: Remove Closed files from file list.

@cullmann would you be able to give us a insight about this?
We are using KTextEditor, and the current code is crashing when Atelier closes if we have two or more files open.
Thanks

patrickelectric accepted this revision.EditedMay 3 2018, 2:24 PM

@laysrodrigues What is the problem of this PR ?

@patrickelectric The problem is that since we dont remove the views, they start to have conflict and the files are not managed properly by KTextEditor and guiFactory(Main Window).
See the discussion on telegram.

@patrickelectric The problem is that since we dont remove the views, they start to have conflict and the files are not managed properly by KTextEditor and guiFactory(Main Window).
See the discussion on telegram.

I took a look in kate source code, and removeClient only appears in the destructor or removing the the tab. Link.

@patrickelectric Kate has a view manager, that changes the factory when something changes see https://github.com/KDE/kate/blob/master/kate/kateviewmanager.cpp#L610
As you can see to activate a new view it removes the previous one.

patrickelectric requested changes to this revision.May 3 2018, 7:08 PM

@patrickelectric Kate has a view manager, that changes the factory when something changes see https://github.com/KDE/kate/blob/master/kate/kateviewmanager.cpp#L610
As you can see to activate a new view it removes the previous one.

Ty, if that's the normal functionality. I would agree to return the currentIndexChanged logic and only add the destructor for this patch.

Hi, I think the reference to kateviewmanager.cpp is a good hint for how to implement it "correctly".
Unfortunately the proper xmlgui client handling is a bit hard.
You always need to add/remove the clients from your factory.
As you see, kate uses some class to disable updates during that process, to avoid nasty toolbar/menu flickering as comfort feature.
If you properly remove the stuff, no crashs shall happen. At least I am not aware of such issues.

rizzitello abandoned this revision.May 3 2018, 9:54 PM

I have found a different way to fix the crash without removing the code here.. I will abandon this revision and use that one..