Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ouuan
Copy link
Member

@ouuan ouuan commented Jan 8, 2020

See the commit messages for more information.

ouuan added 5 commits January 8, 2020 21:03
Use the competitive companion logic introduced in 22af606 and 1b1058a (don't open new tabs).
Use AppWindow::openFile() for opening files.

Thus fix bug of opening files via command line arguments / drag & drop.

Duplicate files were not detected when opening via these two ways before.
@ghost
Copy link

ghost commented Jan 8, 2020

Hi ouuan
Thank you for your contribution to cp-editor2. I will request a review from one of the contributor. Once they approves and all CI checks passes, I will merge your Pull Request.

@ghost ghost requested a review from coder3101 January 8, 2020 14:22
ouuan added 6 commits January 9, 2020 12:48
Segment fault in the following situations are fixed:

1. all tabs are closed, apply settings in preference window

2. all tabs are closed, received a competitive companion request

After fixing, if all tabs are closed and a competitive companion
request is received, a new tab will be opened for it.
This is the same as many other text editors, for example, Sublime Text.

"Unsaved file" is a little confusing, it may be understood as "file with
unsaved changes".
@ouuan
Copy link
Member Author

ouuan commented Jan 9, 2020

I'm solving a segmentation fault introduced in 358c3fe, please wait before merge.

@ouuan
Copy link
Member Author

ouuan commented Jan 9, 2020

To reproduce the segmentation fault:

  1. open the editor
  2. open a new tab (then there are two tabs, and the current tab is the second one)
  3. close the first tab

If you switch to the first tab and close the second one, everything works well.

Deleting https://github.com/coder3101/cp-editor/blob/358c3feaacff46b1807f0697dd7526b1fb9a245b/src/appwindow.cpp#L230 will solve this segmentation fault (but I can't delete it). But calling tmp->disconnect() before closing it won't solve this segmentation fault.

Do you have ideas on how to solve this?

@ouuan
Copy link
Member Author

ouuan commented Jan 9, 2020

I think I got the reason, switch to a tab will cause a editorTextChanged, and the windowIndex has not been updated yet.

ouuan added 3 commits January 9, 2020 15:38
To reproduce the segmentation fault:

1. open the editor
2. open a new tab (then there are two tabs, and the current tab is the second one)
3. close the first tab

If you switch to the first tab and close the second one, everything works well.

It's caused by not updated windowIndex.

It's fixed by updating windowsIndex in onTabChanged().
Copy link
Member

@coder3101 coder3101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I merge it now?

@ghost ghost added the ready_to_merge label Jan 9, 2020
@ouuan
Copy link
Member Author

ouuan commented Jan 9, 2020

OK, you can merge it.

@coder3101 coder3101 merged commit 3fa4eb0 into cpeditor:master Jan 9, 2020
@ouuan ouuan deleted the tabs branch January 9, 2020 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants