Menu Popup in TextEditor is freezing PC
Posted
#1
(In Topic #1523)
Regular

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!
Posted
Administrator

Without any code hard to say.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.
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 .
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!
- 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!
Posted
Regular

Posted
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.
Posted
Regular

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
Posted
Regular

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
Posted
Guru

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.
Posted
Regular

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.
Posted
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
Posted
Regular

Posted
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.
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?
Posted
Regular

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
Posted
Guru

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.
Posted
Administrator

Good practice is never harmful for skill development..sergioabreu said
I didn't know the existence of that… so I wrote it from zero LOL
It was a nice chalenge
I'm not surprised, same happens to me very often since I discovered it back in 2009 and still does…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>
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!
- 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!
1 guest and 0 members have just viewed this.

