Sign up

Pages: 1 2

Crash when showing dialog

I am trying to show a dialog from a popup menu.

When I RMB to bring up the popup menu and click on the item, it calls dialog.showAll.

The dialog pops up.

Now, if I close it and repeat this process(Without shutting down the app), the second time the dialog pops up without a title bar(may be completely empty as I have no items on it)... and when I close it again the app and debugger crash ;/

MenuSelect.addOnActivate((MenuItem mi)
									{
									    dialog.showAll();
														return;
									});

The code above is literally that simple. I just call showAll.

I'm not sure if I'm suppose to "clean up" something before I show it again and if that is the reason why it is behaving that way or if it's a more serious bug.

I'm using the same code all through out my app and it is working fine... only on this popup is there an issue.

I added some stuff to the dialog and it doesn't show up ;/

dialog.showAll();
dialog.hide();
dialog.showAll();
dialog.hide();
dialog.showAll();
dialog.hide();
dialog.showAll();
dialog.hide();
    dialog.showAll();


If run this code at the start of the app, it does not crash. When I then run the showAll inside the onActivate it is blank and crashes when clicked.

It seems that after the dialog has been shown once, calling showAll inside onActivate causes major issues.

Any ideas why this might be? Remember, it strictly seems to be an issue with using showAll inside OnActivate more than once.

It happens also with addOnButtonPress. In fact, it seems to happen when ever it is called in one of the handlers I'm using to try and get it to pop up.

None of the other dialog's are effected even when this one craps out.

Re: Crash when showing dialog

On Tue, 28 May 2019 21:23:59 GMT, Alex X wrote:

dialog.showAll();

This needs to be followed by:

dialog.destroy();

Just a guess without seeing your source in its entirety.

Re: Crash when showing dialog

You do know about the gtkDcoding blog, right? I'm in the middle of posting an entire series on Dialogs. Perhaps it'll help.

Re: Crash when showing dialog

On Wed, 29 May 2019 08:50:02 GMT, Ron Tarrant wrote:

On Tue, 28 May 2019 21:23:59 GMT, Alex X wrote:

dialog.showAll();

This needs to be followed by:

dialog.destroy();

Just a guess without seeing your source in its entirety.

Ok, I thought about something like that.

The problem is this.

  1. Does not clicking on the x destroy it?

  2. I have many dialogs that I use and I never call destroy(just hide) and they work find and are repeatable... so why in this one particular case is it required?

Re: Crash when showing dialog

On Wed, 29 May 2019 08:52:52 GMT, Ron Tarrant wrote:

You do know about the gtkDcoding blog, right? I'm in the middle of posting an entire series on Dialogs. Perhaps it'll help.

I don't have an issue using dialogs, I have many in my app and they all work, it's this one case where I use a popup window that shows a dialog and it doesn't work.

Also, the dialog itself is not even shown correctly the first time when shown within the onactivate.

Using

dialog.destroy() does nothing.

Try creating a popup window and have that open a dialog and see if that works(must open it multiple times).

Again, I have about 20 dialogs in my app and all of them work fine. It's only this one and only when I open it up a second time. It's as if something is getting corrupted by the popup aspect.

Re: Crash when showing dialog

On 29-05-2019 20:12, Alex X wrote:

On Wed, 29 May 2019 08:52:52 GMT, Ron Tarrant wrote:

You do know about the gtkDcoding blog, right? I'm in the middle of posting an entire series on Dialogs. Perhaps it'll help.

I don't have an issue using dialogs, I have many in my app and they all work, it's this one case where I use a popup window that shows a dialog and it doesn't work.

Also, the dialog itself is not even shown correctly the first time when shown within the onactivate.

Using

dialog.destroy() does nothing.

Try creating a popup window and have that open a dialog and see if that works(must open it multiple times).

Again, I have about 20 dialogs in my app and all of them work fine. It's only this one and only when I open it up a second time. It's as if something is getting corrupted by the popup aspect.

Does the same thing happen when you use dialog.run() instead of
showAll ?

Re: Crash when showing dialog

On Wed, 29 May 2019 20:27:30 +0200, Mike Wey wrote:

On 29-05-2019 20:12, Alex X wrote:

On Wed, 29 May 2019 08:52:52 GMT, Ron Tarrant wrote:

You do know about the gtkDcoding blog, right? I'm in the middle of posting an entire series on Dialogs. Perhaps it'll help.

I don't have an issue using dialogs, I have many in my app and they all work, it's this one case where I use a popup window that shows a dialog and it doesn't work.

Also, the dialog itself is not even shown correctly the first time when shown within the onactivate.

Using

dialog.destroy() does nothing.

Try creating a popup window and have that open a dialog and see if that works(must open it multiple times).

Again, I have about 20 dialogs in my app and all of them work fine. It's only this one and only when I open it up a second time. It's as if something is getting corrupted by the popup aspect.

Does the same thing happen when you use dialog.run() instead of
showAll ?

[SKIP TO------>HERE]

There is no run:

Error: no property run for type gtk.Window.Window

(I'm using a window, trying with a real dialog)

Same problem. Shows up the first time but then corrupt the second(the window that pops up is smaller and just a gray rectangle with a square).

I feeling is that some how the popup handler is corrupting the window. I'm going to try to dispatch it... same issue.

dialog.run(); 
dialog.destroy(); 
dialog.run(); 
dialog.destroy(); 
dialog.run(); 
dialog.destroy(); 


does not work, unlike when I use a window and hide and show

For example, this works:

dialog.run();
dialog.showAll(); 
dialog.hide(); 
dialog.showAll(); 
dialog.hide(); 
dialog.showAll(); 
dialog.hide(); 
dialog.run();
dialog.run();


The showAll doesn't seem do do anything.

but running it 3 times requires me to close it 3 times... but it always shows up properly.

[------HERE]

What seems to be happening is something like this:

When closing out the window/dialog it destroys the window and it is not recovered(Remember, I'm using glade builder to generate the window).

If I do

dialog.run();
dialog.destroy();

dialog.run();

Then after the first close the window is screwed up on the next run

So it seems like the window is being destroyed and I'm trying to run a destroyed window/dialog.

I do not destroy it but only click on the x in upper right corner. So somewhere there is an implicit destroy in the code or something is trashing the window/dialog somehow.

Re: Crash when showing dialog

On 29-05-2019 23:52, Alex X wrote:

[SKIP TO------>HERE]

There is no run:

Error: no property run for type gtk.Window.Window

(I'm using a window, trying with a real dialog)

Same problem. Shows up the first time but then corrupt the second(the window that pops up is smaller and just a gray rectangle with a square).

I feeling is that some how the popup handler is corrupting the window. I'm going to try to dispatch it... same issue.

dialog.run();
dialog.destroy();
dialog.run();
dialog.destroy();
dialog.run();
dialog.destroy();


does not work, unlike when I use a window and hide and show

For example, this works:

dialog.run();
dialog.showAll();
dialog.hide();
dialog.showAll();
dialog.hide();
dialog.showAll();
dialog.hide();
dialog.run();
dialog.run();


The showAll doesn't seem do do anything.

but running it 3 times requires me to close it 3 times... but it always shows up properly.

[------HERE]

What seems to be happening is something like this:

When closing out the window/dialog it destroys the window and it is not recovered(Remember, I'm using glade builder to generate the window).

If I do

 dialog.run();
 dialog.destroy();

dialog.run();

Then after the first close the window is screwed up on the next run

So it seems like the window is being destroyed and I'm trying to run a destroyed window/dialog.

I do not destroy it but only click on the x in upper right corner. So somewhere there is an implicit destroy in the code or something is trashing the window/dialog somehow.

If you are using a window, then the default handler for the close button
will destroy the window, and unref and possibly destroy it's children.

You will need to connect a handler that hides the window instead of
destroying it:

dialog.addOnDelete((_, widget){ widget.hide(); return true; });

A dialog.run does this for you, which is why you need to call hide
or destroy when run returns.

Re: Crash when showing dialog

On Thu, 30 May 2019 00:37:25 +0200, Mike Wey wrote:

On 29-05-2019 23:52, Alex X wrote:

[SKIP TO------>HERE]

There is no run:

Error: no property run for type gtk.Window.Window

(I'm using a window, trying with a real dialog)

Same problem. Shows up the first time but then corrupt the second(the window that pops up is smaller and just a gray rectangle with a square).

I feeling is that some how the popup handler is corrupting the window. I'm going to try to dispatch it... same issue.

dialog.run();
dialog.destroy();
dialog.run();
dialog.destroy();
dialog.run();
dialog.destroy();


does not work, unlike when I use a window and hide and show

For example, this works:

dialog.run();
dialog.showAll();
dialog.hide();
dialog.showAll();
dialog.hide();
dialog.showAll();
dialog.hide();
dialog.run();
dialog.run();


The showAll doesn't seem do do anything.

but running it 3 times requires me to close it 3 times... but it always shows up properly.

[------HERE]

What seems to be happening is something like this:

When closing out the window/dialog it destroys the window and it is not recovered(Remember, I'm using glade builder to generate the window).

If I do

 dialog.run();
 dialog.destroy();

dialog.run();

Then after the first close the window is screwed up on the next run

So it seems like the window is being destroyed and I'm trying to run a destroyed window/dialog.

I do not destroy it but only click on the x in upper right corner. So somewhere there is an implicit destroy in the code or something is trashing the window/dialog somehow.

If you are using a window, then the default handler for the close button
will destroy the window, and unref and possibly destroy it's children.

You will need to connect a handler that hides the window instead of
destroying it:

dialog.addOnDelete((_, widget){ widget.hide(); return true; });

A dialog.run does this for you, which is why you need to call hide
or destroy when run returns.

I just updated to your new release and it does not crash, but the second time the window opens only the title bar shows.

I added your onDelete and it works!

Thanks.

Only question I have left is, what is the diff between a dialog and a window? is it just the extra plumbing such as a parallel wnd proc? Basically is there any real use using a dialog over a window? I'm just having them pop up for user interaction and design my own using glade. I don't see any difference. Both can be modal, etc.

I didn't notice in difference in the libs from the new update. (the files were exactly the same size)

Also, what did chance was some icons now are much larger. Well, one is like 32x32 and is causing a row to be very large. Everything was defaulting before and was 16x16. Just curious. This was after updating the runtime.

Actually the icon is external so it hasn't changed... I'll just rescale it manually.

Re: Crash when showing dialog

Also, what did chance was some icons now are much larger. Well, one is like 32x32 and is causing a row to be very large. Everything was defaulting before and was 16x16. Just curious. This was after updating the runtime.

Actually the icon is external so it hasn't changed... I'll just rescale it manually.

The icon contains multiple sizes and I guess it's choosing a different sized one or not scaling it down.

Pages: 1 2