Menu Popup in TextEditor is freezing PC

Post

Posted
Rating:
#1 (In Topic #1523)
Regular
sergioabreu is in the usergroup ‘Regular’
Hi friends

I have made a text editor that  has autocomplete.

SOMETIMES… in the moment that the Menu POPS out with the options to autocomplete, - I repeat is NOT ALWAYS, rarelly … the<COLOR color="#800040"> PC  freezes totally </COLOR>and I have to press CTRL+ALT+F1 and kill the editor. I have added also an AUTOSAVE feature every 2 minutes, so, when I get back I just move the file~ to file and go on

Any ideas on the reason of this freeze?

I trigger it on texteditor_keyrelease event, and it mounts a little menu and POPS out. When the Murphy sometimes apear.

Thanks in advance!
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

sergioabreu said

Any ideas on the reason of this freeze?

I trigger it on texteditor_keyrelease event, and it mounts a little menu and POPS out. When the Murphy sometimes apear.
Without any code hard to say.

But something that might help is check if any other events get triggered that might cause interference.

Do this for texteditor (see example below) but also for ALL other coded events on the form, so you see when what is triggered and if some out of the ordinary event triggers that interferes somehow .

Code (gambas)

  1. Public Sub TextEditor1_keyrelease()
  2.  
  3.   Debug"TextEditor1_keyrelease"
  4.  
Run from IDE and check in console what is happening and when.

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
sergioabreu is in the usergroup ‘Regular’
Nice tip, thanks :)
Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’

sergioabreu said

Hi friends

I have made a text editor that  has autocomplete.

SOMETIMES… in the moment that the Menu POPS out with the options to autocomplete, - I repeat is NOT ALWAYS, rarelly … the<COLOR color="#800040"> PC  freezes totally </COLOR>and I have to press CTRL+ALT+F1 and kill the editor. I have added also an AUTOSAVE feature every 2 minutes, so, when I get back I just move the file~ to file and go on

Any ideas on the reason of this freeze?

Thanks in advance!

It'll be a bug in your autocomplete code.

Also ideally you should use Autocomplete through a timer and not in the Key event.
Or use the new "After Do" syntax.
Online now: No Back to the top

Post

Posted
Rating:
#5
Regular
sergioabreu is in the usergroup ‘Regular’
Thanks for the info, Bruce.
The key_event is to detect the situation to insert an auto_complete.
<COLOR color="#0000FF">Should so this detection be done by a timer ?</COLOR>
I am using timer now only to select/modify selected text but your observations are important.
Regards
Online now: No Back to the top

Post

Posted
Rating:
#6
Regular
sergioabreu is in the usergroup ‘Regular’
By now I just added a Try before the Popup line and haven't seen the bug since that.
It's funny that it occurs only once in 100 times.
I suspect that could be something in memory that becomes dangerous after the editor is working a long time and with more than one file open together that causes the crash because when I open a fresh editor after booting the bug never happens.
Might also be a bug in the multiple files/tabs management since the autocomplete reads files from all tabs to find a possible match to what I am typing.
Maybe I have to improve this part
It's very probable that the first reply is correct (events crashing)
Still observing  and
Thanks to all
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’
Are you using gambas Completion.class or have you made your own version?

I understand you are using key event to detect if you should use auto-complete (of course)
but what I am saying is you "should" do something like this..

In the key event if auto-complete must show then start a timer that shows the popup.

this allows the event loop to continue to work as expected. if you do too much in the Key event then you will get problems as the event loop is stuck in the current key event.
Most control events are fine but Key and Mouse events can cause you problems and QT or GTK behave differently causing more confusion.
That's why the tip :)

Hope that all makes sense.
Online now: No Back to the top

Post

Posted
Rating:
#8
Regular
sergioabreu is in the usergroup ‘Regular’
 Yeah I thank you all

I use Xubuntu 18 - and don't want to upgrade, I think it is a perfect distro for my PC.
I am a bit afraid of upgrading Gambas and see it uncompatible with my current system.
Online now: No Back to the top

Post

Posted
Rating:
#9
Regular
sergioabreu is in the usergroup ‘Regular’
Are you using gambas Completion.class or have you made your own version?

I didn't know the existence of that… so I wrote it from zero LOL
It was a nice chalenge
Online now: No Back to the top

Post

Posted
Rating:
#10
Regular
sergioabreu is in the usergroup ‘Regular’
I confess to you all that I pass "more than a half day" everyday coding in gambas since I found it <COLOR color="#ff0099"></COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#11
Guru
BruceSteers is in the usergroup ‘Guru’

sergioabreu said

Yeah I thank you all

I use Xubuntu 18 - and don't want to upgrade, I think it is a perfect distro for my PC.
I am a bit afraid of upgrading Gambas and see it uncompatible with my current system.

er what?? I did not ask about your system version.  :lol:

Maybe my question did not translate to Brazilian very well?  I'll rephrase it…

Are you using gambas Completion.class or have you made your own type of auto-complete?
Online now: No Back to the top

Post

Posted
Rating:
#12
Regular
sergioabreu is in the usergroup ‘Regular’
No I did not misunderstand you

I got the Completion class part and I answered that I din't know the existence of it when I needed it, so I found funny to write one.

My comment about Xubuntu 18 was in response to you "<COLOR color="#000080">new AFter Do</COLOR>" point

PS: Relax about the English part I have passed a Cambridge certification  ;)
Online now: No Back to the top

Post

Posted
Rating:
#13
Guru
BruceSteers is in the usergroup ‘Guru’
Aah I see sorry i missed that post.

Well it's going to be harder to help with issues if you're not using the Completion.class.
Unless you post an example project that has the bugs :)

But hopefully you've cracked it.
Online now: No Back to the top

Post

Posted
Rating:
#14
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

sergioabreu said

I didn't know the existence of that… so I wrote it from zero LOL
It was a nice chalenge
Good practice is never harmful for skill development.. ;)

sergioabreu said

I confess to you all that I pass "more than a half day" everyday coding in gambas since I found it <COLOR color="#ff0099"></COLOR>
I'm not surprised, same happens to me very often since I discovered it back in 2009 and still does…  :D

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top
1 guest and 0 members have just viewed this.