It is currently March 28th, 2024, 10:46 pm

Crash when closing skin after !Move

Report bugs with the Rainmeter application and suggest features.
Mat2095
Posts: 4
Joined: March 18th, 2018, 11:47 pm

Crash when closing skin after !Move

Post by Mat2095 »

I have a skin with a LUA-Script that moves (https://docs.rainmeter.net/manual/bangs/#Move) the skin on every update. If i close the skin, rainmeter crashes, but only under certain conditions:

It only crashes if the the rainmeter-settings are open and the settings for that skin are loaded. If I select another skin/folder on the left (and close the skin either by rightclicking the skin or with the tray-icon-menu), it doesn't crash. However, if I select the skin and then go to the themes-tab in the settings, it still crashes (since the settings are still loaded, but not currently visible).

Also, increasing the Update-variable reduces the chance of a crash. E.g. with a value of 50ms, it basically always crashes; with a value of 500ms, you need to time the closing correctly to make it crash. I'd assume it only crashes if you close it within x milliseconds after the !Move.


Minimal Skin:

Code: Select all

[Rainmeter]
Update=50

[CrashTestScript]
Measure=Script
ScriptFile=CrashTest.lua

[CrashTestMeter]
Meter=String
Text=CrashTest
UpdateDivider=-1

Code: Select all

function Update()
	SKIN:Bang('!Move', 0, 0)
end
I'm using Rainmeter 4.2.0 beta r3029 64bit on Windows 10.


Edit:
After the crash, I can reopen Rainmeter without a problem and the skin has actually been closed.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Crash when closing skin after !Move

Post by eclectic-tech »

Okay, I'll bite, why would you want to move a skin to the upper left corner 20 times a second? :???:

Beyond that, why do it in a lua script, when you could do it in a measure in the skin? :confused:

Lastly, you should probably post your entire package so your issue can be duplicated. That is not possible without having the same skins loaded... :welcome:
Mat2095
Posts: 4
Joined: March 18th, 2018, 11:47 pm

Re: Crash when closing skin after !Move

Post by Mat2095 »

This is a minimal version to reproduce the crash. In the actual skin the location changes on every update and the calculations are more complicated, so a LUA script is required. But why would I post 100s of lines of code if 14 are enough?

When simplifying, the possibility of doing it in a measure instead of a script didn't come to me. I've just checked, the crash still occurs that way.

For me, no other skins are required to reproduce the crash.

Edit:
Added package.
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Crash when closing skin after !Move

Post by eclectic-tech »

What you posted will crash Rainmeter if selected in Manage and you unload it...
(It also has a script measure with no script, but that doesn't matter).

Code: Select all

[Rainmeter]
Update=50

[CrashTestScript]
Measure=Script
OnUpdateAction=!Move 0 0

[CrashTestMeter]
Meter=String
Text=CrashTest
UpdateDivider=-1
I suspect you are pulling the rug out from under the !Move action, which is an endless loop in your skin trying to move and redraw the skin 20 times second. I still see no reason to use this action constantly?

This code runs at the same speed, but uses a condition test, and only fires when the skin is not at 0,0.
It will do the same thing but not crash.

Code: Select all

[Rainmeter]
Update=50
AccurateText=1
DynamicWindowSize=1
Group=#RootConfig#

; ========= Measures ==========
[MeasureCalc]
Measure=Calc
Formula=1
IfCondition=(#CurrentConfigX#<>0)||(#CurrentConfigY#<>0)
IfTrueAction=[!Move "0" "0"]
IfFalseAction=[]
IfConditionMode=1
DynamicVariables=1

; ========= Meters ==========
[MeterImage]
Meter=Image
W=100
H=100
SolidColor=100,100,100
:17flag
Mat2095
Posts: 4
Joined: March 18th, 2018, 11:47 pm

Re: Crash when closing skin after !Move

Post by Mat2095 »

Well, there is no "empty" Measure, so I have to use a dummy to be able to make an OnUpdateAction. This is basically the same way you used a Calc-Measure that doesn't actually calc anything.

As I said, the location in the non-minimal script changes every update (e.g. move 1 pixel down each time).

Anyway, I think we're talking past each other. The skin is fine, it doesn't do anything "illegal" (correct me if I'm wrong). While it IS useless in this minimal variation, that is not the point. The problem is rainmeter, as it shouldn't crash when closing a skin.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Crash when closing skin after !Move

Post by eclectic-tech »

The skin is fine, it doesn't do anything "illegal" (correct me if I'm wrong). While it IS useless in this minimal variation, that is not the point. The problem is rainmeter, as it shouldn't crash when closing a skin.
There may be a bug, and the Dev's may be looking at that.

Your skins may not be doing anything "illegal", but maybe unnecessarily busy.

I look at it this way...
If I want to keep a door closed, I would check if it is open, and then close it. :17nodding

You are opening and closing the door 20 times a second, even if it is already closed!? :17denial

My suggestion would be to use a different method.

Good luck with your project. :17flag
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Crash when closing skin after !Move

Post by Brian »

Thank you for reporting this bug and it has been fixed for the next beta.

[Details]
The problem was the skin was being unloaded at the same time as the Update function was being ran (due to the high update rate). In a normal situation when the a skin is being unloaded, it will send a message to the Manage dialog to disable any skin related controls. In this situation, the !Move bang was also telling the skin to move which in turn tells the Manage to update it's values....however, the skin was in the process of unloading and technically didn't exist, so it was trying to grab a nonexistent value.
[\Details]

-Brian
Mat2095
Posts: 4
Joined: March 18th, 2018, 11:47 pm

Re: Crash when closing skin after !Move

Post by Mat2095 »

Awesome, thanks! :thumbup: